Codebase list tk8.6 / e6491ef
New upstream version 8.6.0~b1 Sergei Golovan authored 15 years ago Sergei Golovan committed 6 years ago
282 changed file(s) with 20431 addition(s) and 11211 deletion(s). Raw diff Collapse all Expand all
0 2008-10-10 Don Porter <dgp@users.sourceforge.net>
0 2008-12-19 Don Porter <dgp@users.sourceforge.net>
1
2 *** 8.6b1 TAGGED FOR RELEASE ***
3
4 * changes: Updates for 8.6b1 release.
5
6 * tests/clrpick.test: Eliminate duplicate test names.
7 * tests/embed.test:
8 * tests/text.test:
9 * tests/textMark.test:
10
11 * README: Bump version number to 8.6b1
12 * generic/tk.h:
13 * library/tk.tcl:
14 * unix/configure.in:
15 * unix/tk.spec:
16 * win/configure.in:
17
18 * unix/configure: autoconf-2.59
19 * win/configure:
20
21 2008-12-18 Don Porter <dgp@users.sourceforge.net>
22
23 * library/msgs/de.msg: Updated German messages. Thanks to Ruediger
24 Haertel. [Patch 2442309].
25
26 2008-12-17 Jan Nijtmans <nijtmans@users.sf.net>
27
28 * generic/tk.h: VOID --> void
29 * unix/tkUnixPort.h:
30 * macosx/tkMacOSXPort.h:
31
32 2008-12-17 Donal K. Fellows <dkf@users.sf.net>
33
34 * doc/selection.n: Assorted small fixes. [Bugs 2441817,2441884]
35
36 2008-12-16 Jan Nijtmans <nijtmans@users.sf.net>
37
38 * win/tkWinDialog.c: Remove unused variables
39
40 2008-12-15 Don Porter <dgp@users.sourceforge.net>
41
42 TIP #338 IMPLEMENTATION
43
44 * doc/Tk_Main.c: Removed the last two '#include "tclInt.h"'.
45 * generic/tkMain.c: Tk is now limited to Tcl's public interface.
46 * macosx/tkMacOSXInit.c:
47
48 2008-12-12 Pat Thoyts <patthoyts@users.sourceforge.net>
49
50 * library/demos/fontchoose.tcl: Simple fontchooser demo
51 * library/demos/widget:
52
53 2008-12-11 Jan Nijtmans <nijtmans@users.sf.net>
54
55 * generic/tk3d.c: Make error message from Tk_GetRelief the same as
56 for Tk_GetReliefFromObj.
57 * tests/canvas.test Adapt test cases for changed error message.
58 * tests/scrollbar.test
59 * tests/textTag.test
60
61 2008-12-11 Joe English <jenglish@users.sourceforge.net>
62
63 * library/demos/*.tcl: Omit contraindicated [package require Ttk].
64 Remove logic that switches [ttk::scrollbar]s to [tk::scrollbar]s
65 based on [tk windowingsystem]; this is already handled in
66 library/ttk/scrollbar.tcl.
67
68 2008-12-10 Daniel Steffen <das@users.sourceforge.net>
69
70 TIP #324 IMPLEMENTATION
71
72 * generic/tkCmds.c: Implementation of [tk fontchooser] as
73 * generic/tkInt.h: a Ttk dialog for X11 and as a native
74 * win/tkWinDialog.c: platform dialog on Mac OS X & Windows.
75 * win/tkWinInt.h: (thoyts, vetter, robert, steffen)
76 * win/tkWinTest.c: [Patch 1477426]
77 * win/tkWinX.c:
78 * macosx/tkMacOSXCarbonEvents.c:
79 * macosx/tkMacOSXDialog.c:
80 * macosx/tkMacOSXEvent.c:
81 * macosx/tkMacOSXEvent.h:
82 * macosx/tkMacOSXFont.c:
83 * macosx/tkMacOSXFont.h:
84 * macosx/Wish.xcodeproj/project.pbxproj:
85 * library/fontchooser.tcl (new):
86 * library/tclIndex:
87 * library/msgs/de.msg:
88 * library/msgs/en.msg:
89 * tests/fontchooser.test (new):
90 * tests/winDialog.test:
91 * doc/fontchooser.n (new):
92 * doc/tk.n:
93
94 * library/console.tcl: Let user select console font via
95 [tk fontchooser].
96 * library/demos/text.tcl: Add [tk fontchooser] demo.
97
98 * generic/tkUtil.c: Add TkBackgroundEvalObjv() and
99 TkSendVirtualEvent() utility functions
100 (used by TIP #324 code).
101
102 * generic/tkInt.h: Turn [tk] into an ensemble.
103 * generic/tkBusy.c: (thoyts, steffen)
104 * generic/tkCmds.c:
105 * generic/tkWindow.c:
106
107 * macosx/tkMacOSXInit.c (TkpInit): Unconditionally show Tk console
108 if TK_CONSOLE env var is set.
109
110 2008-12-09 Don Porter <dgp@users.sourceforge.net>
111
112 TIP #337 IMPLEMENTATION
113
114 * generic/tkBind.c: Updated callers of Tcl_BackgroundError()
115 * generic/tkCanvas.c: to use the new routine
116 * generic/tkEntry.c: Tcl_BackgroundException() as appropriate.
117 * generic/tkImgBmap.c:
118 * generic/tkListbox.c:
119 * generic/tkSelect.c:
120 * generic/tkTextDisp.c:
121 * generic/tkTextWind.c:
122 * macosx/tkMacOSXHLEvents.c:
123 * macosx/tkMacOSXMenu.c:
124 * macosx/tkMacOSXMenus.c:
125 * macosx/tkMacOSXScale.c:
126 * macosx/tkMacOSXWindowEvent.c:
127 * unix/tkUnixScale.c:
128 * unix/tkUnixWm.c:
129 * win/tkWinButton.c:
130 * win/tkWinMenu.c:
131 * win/tkWinScrlbr.c:
132 * win/tkWinWm.c:
133
134 2008-12-07 Joe English <jenglish@users.sourceforge.net>
135
136 * macosx/ttkMacOSXTheme.c: Add native aqua elements for
137 ttk::spinbox [Bug 2219588]
138 * generic/ttk/ttkEntry.c, library/ttk/spinbox.tcl,
139 * tests/ttk/spinbox.test: Moved most spinbox "business logic" out of
140 ttkEntry.c into Tcl bindings.
141 * library/ttk/clamTheme.tcl: Minor spinbox appearance improvements.
142 * library/ttk/combobox.tcl, library/ttk/utils.tcl:
143 Factor out ttk::bindMouseWheel procedure.
144 * library/ttk/spinbox.tcl: Add cross-platform MouseWheel bindings.
145
146 2008-12-06 Donal K. Fellows <dkf@users.sf.net>
147
148 TIP #197 IMPLEMENTATION
149
150 * generic/tkText.c (insertUnfocussedStrings, optionSpecs):
151 * generic/tkText.h (TkText, TkTextInsertUnfocussed):
152 * doc/text.n, tests/text.test:
153 Added definitions/tests/docs for "-insertunfocussed" field.
154 * generic/tkTextMark.c (TkTextInsertDisplayProc):
155 * generic/tkText.c (TextBlinkProc):
156 Added user-controlledrendering of insertion cursor when focus is not
157 in the text widget.
158
159 2008-12-05 Pat Thoyts <patthoyts@users.sourceforge.net>
160
161 * library/ttk/ttk.tcl: Added vista theme to iron out the visual
162 * library/ttk/vistaTheme.tcl: differences between vista and XP.
163 * library/ttk/xpTheme.tcl:
164 * win/ttkWinXPTheme.c:
165
166 2008-12-05 Donal K. Fellows <dkf@users.sf.net>
167
168 * generic/tkCanvPs.c (Tk_PostscriptFont): Ensure that font sizes can
169 ever be negative; it triggers a really strange case that is definitely
170 not what is wanted. [Bug 2107938]
171 * library/mkpsenc.tcl: Corrected and improved generation of postscript
172 * library/prolog.ps: prolog. Removed prolog.ps, which wasn't used and
173 was misleading.
174
175 2008-12-04 Jan Nijtmans <nijtmans@users.sf.net>
176
177 * generic/tkInt.decls: Move 10 functions from tkText.h to
178 * generic/tkText.h: stub table [Feature Request 220906]
179 * generic/tkStubInit.c (regenerated)
180 * generic/tkIntDecls.h (regenerated)
181
182 2008-12-04 Donal K. Fellows <dkf@users.sf.net>
183
184 * doc/ttk_button.n, doc/ttk_checkbutton.n, doc/ttk_menubutton.n:
185 * doc/ttk_radiobutton.n: Added mention of the Toolbutton style to all
186 widgets that can sensibly make use of it.
187
188 2008-12-03 Joe English <jenglish@users.sourceforge.net>
189
190 * generic/ttk/ttkState.c, generic/ttk/ttkTheme.h,
191 * generic/ttk/ttkWidget.c, doc/ttk_widget.n:
192 Add new "hover" state (patch from Pat Thoyts; needed to support proper
193 visual feedback on Vista).
194
195 2008-11-29 Pat Thoyts <patthoyts@users.sourceforge.net>
196
197 * library/ttk/altTheme.tcl: Use a styled frame around the popdown
198 * library/ttk/clamTheme.tcl: listbox so we can adjust the border
199 * library/ttk/classicTheme.tcl: for each theme as needed.
200 * library/ttk/combobox.tcl:
201 * library/ttk/defaults.tcl:
202 * library/ttk/winTheme.tcl:
203 * library/ttk/xpTheme.tcl:
204 * tests/ttk/combobox.test:
205
206 2008-11-28 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
207
208 * generic/tkCanvUtil.c: Millimeter patch. Fixes [1813597,2218964]
209 * generic/tkInt.h: by eliminating the functional redundancy
210 * generic/tkObj.c: and unnecessary loss of precision of the
211 * generic/tkText.c: {pixel,mm}ObjType tandem.
212
213 2008-11-27 Jan Nijtmans <nijtmans@users.sf.net>
214
215 * generic/tkCanvLine.c: Replace Tcl_SetResult(interp, NULL, ....)
216 * generic/tkEntry.c: calls with Tcl_ResetResult(interp)
217 * generic/tkMenu.c
218 * generic/tkOldConfig.c
219 * win/tkWinTest.c: Eliminate warning: unused variable 'tkwin'
220
221 2008-11-23 Pat Thoyts <patthoyts@users.sourceforge.net>
222
223 * generic/tkBind.c: [Bug 1389270] event generate silently ignored
224 * generic/tkFocus.c: focus events. These can now be generated.
225 * generic/tkGrab.c:
226 * generic/tkInt.h:
227 * tests/bind.test: Fixed some locale dependencies in various
228 tests to reduce the noise on non-English windows systems.
229
230 2008-11-22 Donal K. Fellows <dkf@users.sf.net>
231
232 * library/demos/ctext.tcl: Extended to show off what you can do with
233 angled text; there is now a pie selector to change the orientation.
234
235 2008-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
236
237 * library/ttk/combobox.tcl: [Bug 1939129,1991930] combobox dropdown
238 was drawn behind topmost toplevels.
239 * generic/tkCanvText.c: Fixed up complaints from MSVC engendered
240 * generic/tkFont.c: by the last commit. In particular replaced
241 * win/tkWinDraw.c: round() which is a C99 function.
242 * win/tkWinFont.c:
243
244 2008-11-22 Donal K. Fellows <dkf@users.sf.net>
245
246 TIP #119 IMPLEMENTATION
247
248 * generic/tkCanvText.c: Added -angle configuration option to canvas
249 * generic/tkFont.c: text items. This required reengineering the
250 * library/prolog.ps: whole text rendering engine to be able to
251 * macosx/tkMacOSXFont.c: handle an angle! No change to any external
252 * unix/tkUnixFont.c: API. Note, this feature was originally
253 * unix/tkUnixRFont.c: approved for Tk 8.5, but it has proved much
254 * win/tkWinFont.c: harder to implement than originally
255 * generic/tkInt.h: estimated. [Patch 1611359]
256 * tests/canvText.test:
257
258 2008-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
259
260 * test/winDialog.test: Avoid some locale-dependent failures by using
261 * win/tkWinTest.c: id's or an english constraint. [Bug 2307837]
262
263 2008-11-19 Joe English <jenglish@users.sourceforge.net>
264
265 * doc/ttk_panedwindow.n: Remove inoperative text stating that slave
266 windows must be direct children of the master. [Bug 1824996]
267
268 2008-11-19 Jan Nijtmans <nijtmans@users.sf.net>
269
270 * generic/tkImgPhoto.c Minor simplification in fix for [Bug 2312027]
271 no need to malloc and copy photo type name
272 because it is a constant to begin with.
273 * generic/tkOldConfig.c Convert Tcl_SetResult(......, TCL_DYNAMIC) to
274 * mac/tkMacOSXWm.c Tcl_SetResult(......, TCL_VOLATILE), in
275 * unix/tkUnixWm.c preparation for TIP #340
276 * unix/tkUnixSend.c
277 * win/tkWinWm.c
278
279 2008-11-16 Joe English <jenglish@users.sourceforge.net>
280
281 * generic/ttk/ttkWidget.c: Widget self-destruction is not necessarily
282 an error. [Bug 2298720]
283
284 2008-11-16 Donal K. Fellows <dkf@users.sf.net>
285
286 * doc/wm.n: Added note about [wm overrideredirect] so that users will
287 avoid making unwarranted assumptions about how magical it is.
288 Triggered by [Bug 2282861] discussion.
289
290 2008-11-14 Pat Thoyts <patthoyts@users.sourceforge.net>
291
292 * generic/tk.h: The TIP 125 implementation permits the
293 * generic/tkFrame.c: [wm manage] command to manage any widget but
294 * macosx/tkMacOSXWm.c: only those with Frame instance data should be
295 * unix/tkUnixWm.c: permitted. We now check for the suitability and
296 * win/tkWinWm.c: raise an error for non-frame widgets. Updated
297 * test/wm.test: the tests and documentation. See also [Bug
298 * doc/wm.n: 2239034]
299
300 2008-11-12 Joe English <jenglish@users.sourceforge.net>
301
302 * generic/ttk/ttkWidget.c: Reworked widget construction and
303 destruction sequence; fixes [Bug 2207435] and several other problems
304 discovered during investigation of same.
305 * generic/ttk/ttkButton.c (CheckbuttonInitialize): Account for
306 initializeProc being called earlier in the construction sequence now.
307 * tests/ttk/ttk.test: Updated test suite.
308
309 2008-11-12 Pat Thoyts <patthoyts@users.sourceforge.net>
310
311 * library/text.tcl: Handle windows with funky names by avoiding use of
312 * test/text.test: the window path for anchors. [Bug 1777362]
313
314 2008-11-11 Jan Nijtmans <nijtmans@users.sf.net>
315
316 * generic/tkImgPhoto.c Fix [Bug 2265860] new test failures
317
318 2008-11-11 Joe English <jenglish@users.sourceforge.net>
319
320 * generic/ttk/ttkWidget.c(BeginDrawing): Don't crash when application
321 uses nondefault visual. [Bug 2264732]
322
323 2008-11-11 Jan Nijtmans <nijtmans@users.sf.net>
324
325 * win/tcl.m4: Reverted change from 2008-11-06 (was under the
326 impression that "-Wno-implicit-int" added an extra
327 warning)
328 * win/configure (regenerated)
329 * unix/tcl.m4: Use -O2 as gcc optimization compiler flag, and get
330 rid of -Wno-implicit-int for UNIX
331 * unix/configure (regenerated)
332
333 * generic/tk.decls Modify Tk_Create(Old)ImageType signature,
334 * generic/tk.h relaxing the constraint that every Tk_ImageType
335 * generic/tkImage.c can only be passed to this function once. This
336 * generic/tkImgBmap.c lets tkImg be loaded in multiple interpreters
337 * generic/tkImgPhoto.c in a thread-enabled build of Tk. [Bug 2312027]
338 * generic/tkTest.c This CONSTification complies with TIP #27. It
339 * doc/CrtImgType.3 is binary compatible with the old interface,
340 but not fully source compatible (although tkImg
341 does not suffer).
342 * generic/tkDecls.h (regenerated)
343
344 *** POTENTIAL INCOMPATIBILITY ***
345
346 2008-11-09 Joe English <jenglish@users.sourceforge.net>
347
348 * generic/ttk/ttkWidget.c: Remove unnecessary casts.
349
350 * generic/ttk/ttkWidget.h, generic/ttk/ttkWidget.c: Ttk widget
351 initializeProc()s now return void instead of a status code, and are no
352 longer allowed to fail. (Fix for [Bug 2207435] in progress).
353
354 * generic/ttk/ttkButton.c, generic/ttk/ttkEntry.c,
355 * generic/ttk/ttkFrame.c, generic/ttk/ttkNotebook.c,
356 * generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c,
357 * generic/ttk/ttkScale.c, generic/ttk/ttkScrollbar.c,
358 * generic/ttk/ttkTreeview.c: Adjustments for the above.
359
360 2008-11-09 Jan Nijtmans <nijtmans@users.sf.net>
361
362 * generic/tkCanvas.c: Make all Tk_CustomOption tables const and
363 * generic/tkCanvBmap.c: remove unnecessary type cast.
364 * generic/tkCanvImg.c:
365 * generic/tkCanvPoly.c:
366 * generic/tkCanvText.c:
367 * generic/tkCanvWind.c:
368 * generic/tkRectOval.c:
369 * generic/tkScrollbar.c:
370 * generic/tk.decls: Two more (hopefully the last) signature
371 * generic/tkInt.h: changes in Tk_CreateSmoothMethod and
372 * generic/tkCanvLine.c: Tk_CreatePhotoImageFormat
373 * generic/tkCanvUtil.c:
374 * generic/tkImgPhoto.c:
375 * generic/tkDecls.h: (regenerated)
376 * doc/CrtImgType.3: doc updates
377 * doc/CrtPhImgFmt.3:
378
379 2008-11-06 Jan Nijtmans <nijtmans@users.sf.net>
380
381 * win/tcl.m4: Add "-Wno-implicit-int" flag for gcc, as on UNIX
382 * win/configure: (regenerated)
383 * generic/default.h: Use tkUnixDefault.h under CygWin. With this
384 change, at least the X11 version of Tk can be
385 built with cygwin.
386
387 2008-11-06 Donal K. Fellows <dkf@users.sf.net>
388
389 * unix/configure.in: Work around the fact that the HP-UX system
390 compiler cannot handle 'inline'. [Bug 2229999]
391
392 2008-11-05 Jan Nijtmans <nijtmans@users.sf.net>
393
394 * unix/tkUnixFont.c: Fix [Bug 2226093] const changes not all correct
395 * unix/tkUnixButton.c: More internal -Wwrite-strings warning fixes
396 * unix/tkUnixCursor.c:
397 * unix/tkUnixSend.c:
398 * unix/tkUnixRFont.c:
399 * generic/tkInt.h: No need to use CONST in internal header files
400 * generic/tkFont.h
401 * generic/tkInt.decls: CONSTify string and fileName parameters of
402 * generic/tkImgBmap.c: TkGetBitmapData
403 * generic/tkBitmap.c: Remove unneccessary type cast
404 * generic/tkIntDecls.h: (regenerated)
405 * doc/GetCursor.3: Fix documentation about obsolete X10 bitmaps
406 * doc/GetBitmap.3: [Bug 1866774] Remove X10 references from docs
407
408 2008-11-03 Jan Nijtmans <nijtmans@users.sf.net>
409
410 * generic/ttk/ttkEntry.c: Fix warning: unused variable `currentValue'
411 * generic/tkOldTest.c: Fix warning: assignment discards qualifiers
412 * win/tkWinTest.c: from pointer target type
413
414 2008-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
415
416 * tests/winClipboard.test: testclipboard no longer returns strings
417 with embedded \r but now returns Tcl strings
418 * tests/winfo.test: Fixed embedding test broken during upgrade
419 * tests/busy.test: Default wait cursor on windows is 'wait'
420 * win/tkWinFont.c: const fixes for the windows code.
421
422 2008-11-02 Jan Nijtmans <nijtmans@users.sf.net>
423
424 * generic/tkFont.h: More internal -Wwrite-strings warning fixes
425 * generic/tkFont.c
426 * generic/ttk/ttkTheme.h
427 * generic/ttk/ttkDefaultTheme.c
428 * generic/ttk/ttkState.c
429 * macosx/tkMacOSXFont.c
430 * unix/tkUnixFont.c
431 * win/tkWinFont.c
432
433 2008-11-01 Donal K. Fellows <dkf@users.sf.net>
434
435 TIP #97 IMPLEMENTATION
436
437 * generic/tkCanvas.c (CanvasWidgetCmd): Implementation of the 'imove'
438 and 'rchars' subcommands.
439 * generic/tk.h (TK_MOVABLE_POINTS): New flag to allow items to state
440 whether they support finding and moving individual coordinates.
441 * doc/canvas.n, tests/canvas.test: Docs 'n' tests.
442
443 2008-11-01 Pat Thoyts <patthoyts@users.sourceforge.net>
444
445 * generic/ttk/ttkEntry.c: Implemented the themed spinbox
446 * library/ttk/altTheme.tcl: widget.
447 * library/ttk/clamTheme.tcl:
448 * library/ttk/classicTheme.tcl:
449 * library/ttk/defaults.tcl:
450 * library/ttk/entry.tcl:
451 * library/ttk/ttk.tcl:
452 * library/ttk/winTheme.tcl:
453 * library/ttk/xpTheme.tcl:
454 * library/ttk/spinbox.tcl:
455 * win/ttkWinTheme.c:
456 * win/ttkWinXPTheme.c:
457 * doc/ttk_spinbox.n:
458 * tests/ttk/spinbox.test:
459
460 2008-10-31 Joe English <jenglish@users.sourceforge.net>
461
462 * generic/widget.c: Temporary workaround for [Bug 2207435]
463
464 2008-10-30 Jan Nijtmans <nijtmans@users.sf.net>
465
466 * generic/tkAtom.c: more internal -Wwrite-strings warning fixes
467 * generic/tkBusy.c
468 * generic/tkButton.c
469 * generic/tkCanvPoly.c
470 * generic/tkCanvText.c
471 * generic/tkCmds.c
472 * generic/tkListbox.c
473 * generic/tkMenu.c
474 * generic/tkOldConfig.c
475 * generic/tkOption.c
476 * generic/tkPanedWindow.c
477 * generic/tkPlace.c
478 * generic/tkScale.c
479 * generic/tkTest.c
480 * generic/tkText.c
481 * generic/tkTextImage.c
482
483 2008-10-30 Don Porter <dgp@users.sourceforge.net>
484
485 * tests/unixSelect.test: Revise the unixSelect-1.* tests so that
486 they test the ability of Tk's selection mechanism to faithfully pass
487 valid Tcl values without corruption, and stop testing details of
488 Tcl's internal encoding scheme. With this change, the Tk test suite
489 no longer uses the identity encoding or [string bytelength].
490
491 2008-10-30 Jan Nijtmans <nijtmans@users.sf.net>
492
493 * generic/tk.h: CONSTify return value of
494 * generic/tkInt.h Tk_OptionPrintProc, and customPtr
495 * generic/tk.decls field of Tk_ConfigSpec.
496 * generic/tkCanvArc.c See [Bug 2190619]: Warnings due to
497 * generic/tkCanvLine.c Tk_SmoothMethod name constness change
498 * generic/tkCanvUtil.c
499 * generic/tkUtil.c
500 * generic/tkDecls.h: (regenerated)
501
502 2008-10-29 Joe English <jenglish@users.sourceforge.net>
503
504 * generic/tkAtom.c(Tk_GetAtomName): Remove incorrect 'const' qualifier.
505 Remove useless 'register' declarations too, while we're at it.
506
507 2008-10-28 Jan Nijtmans <nijtmans@users.sf.net>
508
509 * generic/tk.h: Add "const" to a few struct member fields.
510 * generic/tkInt.h: CONSTify TkPrintPadAmount
511 * generic/tkSelect.h: move TkSelGetSelection to tkInt.decls
512 * generic/tk.decls: CONSTify Tk_ParseArgv
513 * generic/tkInt.decls: CONSTify TkCreateFrame and TkCreateMainWindow
514 * generic/tkDecls.h: (regenerated)
515 * generic/tkIntDecls.h: (regenerated)
516 * generic/tkArgv.c:
517 * generic/tkAtom.c:
518 * generic/tkEntry.c:
519 * generic/tkFrame.c:
520 * generic/tkImgPhoto.c:
521 * generic/tkPack.c:
522 * generic/tkSelect.c:
523 * generic/tkVisual.c:
524 * generic/tkWindow.c:
525 * win/tkWinTest.c: fix compilation under mingw32
526
527 2008-10-28 Joe English <jenglish@users.sourceforge.net>
528
529 * library/ttk/cursors.tcl, library/ttk/combobox.tcl,
530 library/ttk/entry.tcl, library/ttk/paned.tcl, library/ttk/sizegrip.tcl,
531 library/treeview.tcl:
532 Add correct platform-specific cursors for OSX [Bug 2054562]
533 Expanded set of symbolic cursors. Use correct cursor for
534 ttk::entry and ttk::combobox widgets [Bug 1534835]
535
536 2008-10-28 Don Porter <dgp@users.sourceforge.net>
537
538 * win/tkWinTest.c: Revise [testclipboard] to form that
539 * tests/winClipboard.test: handles encodings. [Bug 2191960]
540 * tests/constraints.tcl: [tcltest::bytestring] no longer used.
541
542 2008-10-24 Joe English <jenglish@users.sourceforge.net>
543
544 * tests/ttk/ttk.test: Disable test ttk-6.3, it's not applicable. [Bug
545 2175411]
546
547 * generic/ttk/ttkTheme.c: Use different Tcl_AssocData key so the tile
548 extension can be loaded into an 8.6 interp, in the off-chance that
549 anyone wants to do this.
550
551 2008-10-24 Donal K. Fellows <dkf@users.sf.net>
552
553 * generic/tkCanvUtil.c (TkSmoothPrintProc): Corrected 'const'ness to
554 quell warning. [Bug 2190619]
555
556 2008-10-23 Don Porter <dgp@users.sourceforge.net>
557
558 * README: Bump version number to 8.6a4
559 * generic/tk.h:
560 * library/tk.tcl:
561 * unix/configure.in:
562 * unix/tk.spec:
563 * win/configure.in:
564
565 * unix/configure: autoconf-2.59
566 * win/configure:
567
568 2008-10-22 Jan Nijtmans <nijtmans@users.sf.net>
569
570 * generic/tk.h: CONST -> const and white-spacing
571 * generic/tk.decls
572 * generic/tkInt.decls
573 * generic/tkDecls.h: (regenerated)
574 * generic/tkIntDecls.h: (regenerated)
575 * generic/tkIntPlatDecls.h: (regenerated)
576 * generic/tkIntXlibDecls.h: (regenerated)
577 * generic/tkPlatDecls.h: (regenerated)
578 * generic/ttk/tk.decls
579 * generic/ttk/ttkDecls.h (regenerated)
580 * generic/ttk/ttkGenStubs.tcl
581
582 2008-10-20 Donal K. Fellows <dkf@users.sf.net>
583
584 * generic/tkBusy.c, macosx/tkMacOSXEmbed.c, unix/tkUnixEmbed.c:
585 * win/tkWinWindow.c: Factor out the platform-specific parts into the
586 platform directories. [Bug 2180919]
587
588 2008-10-18 Donal K. Fellows <dkf@users.sf.net>
589
590 TIP #321 IMPLEMENTATION
591
592 * generic/tkBusy.c, doc/busy.n, tests/busy.test: Implementation of the
593 [tk busy] command. [Patch 1997907]
594
595 2008-10-18 Pat Thoyts <patthoyts@users.sourceforge.net>
596
597 * win/tkWinFont.c: [Bug 1825353] To fix a problem with tiny fonts on
598 Russian versions of Windows we will avoid removing the internal
599 leading for fixed width fonts.
600
601 2008-10-15 Jan Nijtmans <nijtmans@users.sf.net>
602
603 * generic/tk.h: Add "const" to many internal const tables, so
604 * generic/tkBind.c: those will be put by the C-compiler in the
605 * generic/tkButton.c: TEXT segment instead of the DATA segment.
606 * generic/tkCanvas.c: This makes those tables as being shareable in
607 * generic/tkClipboard.c: shared libraries.
608 * generic/tkCmds.c:
609 * generic/tkConsole.c:
610 * generic/tkEntry.c:
611 * generic/tkFocus.c:
612 * generic/tkFrame.c:
613 * generic/tkGet.c:
614 * generic/tkGrab.c:
615 * generic/tkGrid.c:
616 * generic/tkImage.c:
617 * generic/tkImgBmap.c:
618 * generic/tkImgGIF.c:
619 * generic/tkImgPhoto.c:
620 * generic/tkListbox.c:
621 * generic/tkMenu.c:
622 * generic/tkMenu.h:
623 * generic/tkMenubutton.c:
624 * generic/tkMessage.c:
625 * generic/tkOption.c:
626 * generic/tkPack.c:
627 * generic/tkPanedWindow.c:
628 * generic/tkPlace.c:
629 * generic/tkScale.c:
630 * generic/tkSelect.c:
631 * generic/tkSquare.c:
632 * generic/tkTest.c:
633 * generic/tkText.c:
634 * generic/tkTextDisp.c:
635 * generic/tkTextMark.c:
636 * generic/tkTextTag.c:
637 * generic/tkTextWind.c:
638 * macosx/tkMacOSXDialog.c:
639 * macosx/tkMacOSXSend.c:
640 * macosx/tkMacOSXWin.c:
641 * unix/tkUnixFont.c:
642 * unix/tkUnixWm.c:
643 * win/tkWinButton.c:
644 * win/tkWinColor.c:
645 * win/tkWinDialog.c:
646 * win/tkWinMenu.c:
647 * win/tkWinSend.c:
648 * win/tkWinWm.c:
649 * xlib/xcolors.c:
650
651 2008-10-17 Pat Thoyts <patthoyts@users.sourceforge.net>
652
653 * library/ttk/scale.tcl: Implemented keyboard bindings for ttk::scale
654
655 2008-10-15 Jan Nijtmans <nijtmans@users.sf.net>
656
657 * generic/tkInt.h: Add "const" to many internal const tables, so
658 * generic/tk3d.c: those will be put by the C-compiler in the
659 * generic/tkBitmap.c: TEXT segment instead of the DATA segment.
660 * generic/tkColor.c: This makes those tables as being shareable in
661 * generic/tkConfig.c: shared libraries.
662 * generic/tkCursor.c:
663 * generic/tkFont.c:
664 * generic/tkObj.c:
665 * generic/tkStyle.c:
666 * generic/tkTextIndex.c:
667 * generic/tkUtil.c:
668
669 2008-10-14 Donal K. Fellows <dkf@users.sf.net>
670
671 * generic/tkObj.c (TkNewWindowObj): Added utility function for making
672 a Tcl_Obj from a Tk_Window reference. Candidate for future exposure to
673 third-party code I suppose, but useful internal to Tk for sure.
674
675 2008-10-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
676
677 * generic/tkCanvas.c (CanvasWidgetCmd): Corrected result generation.
678
679 2008-10-10 Don Porter <dgp@users.sourceforge.net>
1680
2681 *** 8.6a3 TAGGED FOR RELEASE ***
3682
4683 * changes: Updates for 8.6a3 release.
5684
6 2008-10-09 Don Porter <dgp@users.sourceforge.net>
685 2008-10-09 Don Porter <dgp@users.sourceforge.net>
7686
8687 * generic/tkListbox.c: Make literal return values consistent with
9688 those generated by Tcl_PrintDouble().
14693
15694 2008-10-08 Jan Nijtmans <nijtmans@users.sf.net>
16695
17 * unix/tcl.m4: fix for bug [2073255]
18 * unix/configure: regenerated
19
20 2008-10-08 Don Porter <dgp@users.sourceforge.net>
21
22 * tests/textDisp.test (textDisp-16.34): Update test that tested
23 string equality of double values based on an assumption of
24 tcl_precision==12. Test now does its own formatting.
25
26 * tests/scrollbar.test: Revised testing of the cget subcommand so
27 that it tests consistency with the configure subcommand and not
28 agreement with a hardcoded value that will change as tastes in
29 GUIs evolve.
30
31 * tests/canvText.test (canvText-17.1): Update expected result to
32 match revised PostScript output due to more predictable formatting
33 of floating point values.
696 * unix/tcl.m4: Fix for bug [2073255]
697 * unix/configure: regenerated
698
699 2008-10-08 Don Porter <dgp@users.sourceforge.net>
700
701 * tests/textDisp.test (textDisp-16.34): Update test that tested string
702 equality of double values based on an assumption of tcl_precision==12.
703 Test now does its own formatting.
704
705 * tests/scrollbar.test: Revised testing of the cget subcommand so that
706 it tests consistency with the configure subcommand and not agreement
707 with a hardcoded value that will change as tastes in GUIs evolve.
708
709 * tests/canvText.test (canvText-17.1): Update expected result to match
710 revised PostScript output due to more predictable formatting of
711 floating point values.
34712
35713 * unix/tkUnixWm.c: Restored consistency of error messages from
36714 * macosx/tkMacOSXWm.c: [wm iconphoto] with the test suite and across
37 * tests/unixWm.test: all platforms. [Bug 2021443]
38
39 2008-10-07 Pat Thoyts <patthoyts@users.sourceforge.net>
715 * tests/unixWm.test: all platforms. [Bug 2021443]
716
717 2008-10-07 Pat Thoyts <patthoyts@users.sourceforge.net>
40718
41719 * tests/canvImg.test: Removed dependency on precision in results
42720 * tests/canvRect.test:
43 * tests/canvText.test:
44 * tests/entry.test:
45 * tests/listbox.test:
46 * tests/scrollbar.test:
721 * tests/canvText.test:
722 * tests/entry.test:
723 * tests/listbox.test:
724 * tests/scrollbar.test:
47725 * tests/spinbox.test:
48726 * tests/winWm.test: Fixed incorrect error strings
49 * tests/wm.test:
50
51 2008-10-06 Pat Thoyts <patthoyts@users.sourceforge.net>
727 * tests/wm.test:
728
729 2008-10-06 Pat Thoyts <patthoyts@users.sourceforge.net>
52730
53731 * tests/winDialog.test: Fixed tests for Vista+
54732 * win/tkWinWm.c: corrected some errors from the previous commit
56734 2008-10-05 Donal K. Fellows <dkf@users.sf.net>
57735
58736 * win/tkWinWm.c (WmAttributesCmd, WmOverrideredirectCmd)
59 (WmStackorderCmd):
60 * win/tkWinSendCom.c (Async):
61 * win/tkWinSend.c (Tk_SendObjCmd):
62 * win/tkWinFont.c (TkpGetFontFamilies, TkpGetSubFonts):
63 * unix/tkUnixWm.c (WmOverrideredirectCmd, WmStackorderCmd):
64 * unix/tkUnixFont.c (TkpGetFontFamilies, TkpGetSubFonts):
65 * macosx/tkMacOSXWm.c (WmOverrideredirectCmd, WmStackorderCmd):
66 * generic/tkTextIndex.c (SetTextIndexFromAny):
67 * generic/tkTest.c (TrivialConfigObjCmd):
68 * generic/tkSelect.c (HandleTclCommand):
737 (WmStackorderCmd):
738 * win/tkWinSendCom.c (Async):
739 * win/tkWinSend.c (Tk_SendObjCmd):
740 * win/tkWinFont.c (TkpGetFontFamilies, TkpGetSubFonts):
741 * unix/tkUnixWm.c (WmOverrideredirectCmd, WmStackorderCmd):
742 * unix/tkUnixFont.c (TkpGetFontFamilies, TkpGetSubFonts):
743 * macosx/tkMacOSXWm.c (WmOverrideredirectCmd, WmStackorderCmd):
744 * generic/tkTextIndex.c (SetTextIndexFromAny):
745 * generic/tkTest.c (TrivialConfigObjCmd):
746 * generic/tkSelect.c (HandleTclCommand):
69747 * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd)
70 (PanedWindowSashCommand, PanedWindowProxyCommand):
71 * generic/tkMenubutton.c (Tk_MenubuttonObjCmd):
72 * generic/tkMenu.c (MenuWidgetObjCmd):
73 * generic/tkListbox.c (ListboxWidgetObjCmd):
748 (PanedWindowSashCommand, PanedWindowProxyCommand):
749 * generic/tkMenubutton.c (Tk_MenubuttonObjCmd):
750 * generic/tkMenu.c (MenuWidgetObjCmd):
751 * generic/tkListbox.c (ListboxWidgetObjCmd):
74752 * generic/tkImgPhoto.c (ImgPhotoCmd): (mostly)
75 * generic/tkImage.c (Tk_ImageObjCmd):
76 * generic/tkFont.c (Tk_FontObjCmd, GetAttributeInfoObj):
77 * generic/tkEntry.c (EntryWidgetObjCmd, SpinboxWidgetObjCmd):
78 * generic/tkConfig.c (SetOptionFromAny, Tk_SetOptions):
79 * generic/tkCmds.c (Tk_TkObjCmd, Tk_WinfoObjCmd, TkGetDisplayOf):
753 * generic/tkImage.c (Tk_ImageObjCmd):
754 * generic/tkFont.c (Tk_FontObjCmd, GetAttributeInfoObj):
755 * generic/tkEntry.c (EntryWidgetObjCmd, SpinboxWidgetObjCmd):
756 * generic/tkConfig.c (SetOptionFromAny, Tk_SetOptions):
757 * generic/tkCmds.c (Tk_TkObjCmd, Tk_WinfoObjCmd, TkGetDisplayOf):
80758 * generic/tkButton.c (ButtonCreate): Get rid of code that insists on
81759 non-idiomatically writing to the object in the interpreter result.
82760
118796
119797 * doc/menu.n: Fix typo in docs. [Bug 2098425]
120798
121 2008-09-03 Don Porter <dgp@users.sourceforge.net>
799 2008-09-03 Don Porter <dgp@users.sourceforge.net>
122800
123801 * generic/tk.h: Dropped use of _ANSI_ARGS_ macro to preserve
124802 * generic/tkSelect.h: Tk's TCL_NO_DEPRECATED build.
139817 * tests/winMsbox.test:
140818 * tests/winWm.test:
141819
142 2008-08-28 Don Porter <dgp@users.sourceforge.net>
143
144 * unix/tkConfig.sh.in: Added @XFT_LIBS@ to the definition of TK_LIBS
820 2008-08-28 Don Porter <dgp@users.sourceforge.net>
821
822 * unix/tkConfig.sh.in: Added @XFT_LIBS@ to the definition of TK_LIBS
145823 to avoid link failures when a "big wish" program links against a
146824 --disable-shared build of libtk. (Discovered building expectTk.)
147825
216894 the interaction with the script level) and the photo instances (which
217895 handle display).
218896
219 2008-08-22 Don Porter <dgp@users.sourceforge.net>
897 2008-08-22 Don Porter <dgp@users.sourceforge.net>
220898
221899 *** 8.6a2 TAGGED FOR RELEASE ***
222900
262940 * win/tkWinWindow.c: Remove TkpWindowWasRecentlyDeleted.
263941 * tests/id.test: Remove this unnecessary test.
264942
265 2008-08-19 Joe English <jenglish@users.sourceforge.net>
943 2008-08-19 Joe English <jenglish@users.sourceforge.net>
266944
267945 * generic/ttk/ttkScroll.c: Don't use sprintf "%g" to format floating
268946 point numbers in -[xy]scrollcommand callbacks or [xy]view methods.
315993
316994 2008-08-14 Daniel Steffen <das@users.sourceforge.net>
317995
318 * unix/tcl.m4 (SC_PATH_X): check for libX11.dylib in addition to
996 * unix/tcl.m4 (SC_PATH_X): Check for libX11.dylib in addition to
319997 libX11.so et al.
320998
321 * unix/configure: autoconf-2.59
999 * unix/configure: autoconf-2.59
3221000
3231001 2008-08-12 Ania Pawelczyk <aniap@users.sourceforge.net>
3241002
3271005 * tests/embed.test:
3281006 * tests/main.test:
3291007
330 2008-08-12 Don Porter <dgp@users.sourceforge.net>
1008 2008-08-12 Don Porter <dgp@users.sourceforge.net>
3311009
3321010 * README: Bump version number to 8.6a2
3331011 * generic/tk.h:
3541032 * tests/config.test:
3551033 * tests/canvas.test:
3561034
357 2008-08-05 Joe English <jenglish@users.sourceforge.net>
1035 2008-08-05 Joe English <jenglish@users.sourceforge.net>
3581036
3591037 * generic/tk.h, generic/tkEvent.c: Fix for [Bug 2010422] "no event
3601038 type or button # or keysym while executing "bind Listbox
3671045 * tests/get.test:
3681046 * tests/text.test: Update to tcltest2; report: 33.11 fails
3691047
370 2008-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
1048 2008-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
3711049
3721050 * win/tkWinWm.c: Check wmPtr is valid in TopLevelReqProc to fix
3731051 * tests/wm.test: [Bug 2028703]
3741052
375 2008-07-31 Don Porter <dgp@users.sourceforge.net>
1053 2008-07-31 Don Porter <dgp@users.sourceforge.net>
3761054
3771055 * generic/tk.h: Added missing EXTERN for the Tcl_PkgInitStubsCheck
3781056 declaration to fix inability to embed non-stub-enabled Tk on Windows.
3871065 * tests/cursor.test: Update to tcltest2
3881066 * tests/message.test:
3891067
390 2008-07-26 Pat Thoyts <patthoyts@users.sourceforge.net>
1068 2008-07-26 Pat Thoyts <patthoyts@users.sourceforge.net>
3911069
3921070 * doc/options.n: Direct to the font manual for -font. [Bug 1686012]
3931071
3941072 * tests/constraints.tcl: Add a nonwin contraint.
395 * tests/listbox.test: Conform to testing policy. [Bug 2024753]
1073 * tests/listbox.test: Conform to testing policy. [Bug 2024753]
3961074
3971075 * win/tkWinWm.c: Check that the parent has been mapped before
3981076 * tests/wm.test: calling RemapWindows. [Bug 2009788]
4051083
4061084 2008-07-24 Jan Nijtmans <nijtmans@users.sf.net>
4071085
408 * generic/*.c: fix inconsistant "wrong # args" messages. [Bug 2021443]
1086 * generic/*.c: Fix inconsistant "wrong # args" messages. [Bug 2021443]
4091087 * macosx/tkMacOSXSend.c
4101088 * macosx/tkMacOSXWm.c
4111089 * unix/tkUnixSend.c
4271105 * library/ttk/aquaTheme.tcl: Use system color names and TIP145 named
4281106 font instead of hardcoded color values and deprecated native font name
4291107
430 * macosx/tkMacOSXHLEvents.c: factor out common code; formatting.
431
432 2008-07-08 Pat Thoyts <patthoyts@users.sourceforge.net>
1108 * macosx/tkMacOSXHLEvents.c: Factor out common code; formatting.
1109
1110 2008-07-08 Pat Thoyts <patthoyts@users.sourceforge.net>
4331111
4341112 * doc/*.n: Fixed broken line endings from last doc commit.
4351113
436 2008-07-04 Joe English <jenglish@users.sourceforge.net>
1114 2008-07-04 Joe English <jenglish@users.sourceforge.net>
4371115
4381116 * generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkClamTheme.c,
4391117 * generic/ttk/ttkClassicTheme.c, generic/ttk/ttkElements.c: Audit:
4501128 * doc/*.1, doc/*.3, doc/*.n: Remove out of date changebars, make
4511129 formatting of typedefs consistent, other small changes.
4521130
453 2008-06-25 Don Porter <dgp@users.sourceforge.net>
1131 2008-06-25 Don Porter <dgp@users.sourceforge.net>
4541132
4551133 *** 8.6a1 TAGGED FOR RELEASE ***
4561134
4571135 * changes: Updates for 8.6a1 release.
4581136
459 2008-06-24 Pat Thoyts <patthoyts@users.sourceforge.net>
1137 2008-06-24 Pat Thoyts <patthoyts@users.sourceforge.net>
4601138
4611139 * library/demos/ttkpane.tcl: Work around missing timezones
4621140 * doc/text.n: Fix documentation of text tag options. [Bug 1997293]
4631141
464 2008-06-19 Don Porter <dgp@users.sourceforge.net>
1142 2008-06-19 Don Porter <dgp@users.sourceforge.net>
4651143
4661144 * changes: Updates for 8.6a1 release.
4671145
5051183 incorrect conversion to points of font sizes already in points; factor
5061184 out retrieval of font family name from font family ID.
5071185
508 2008-06-13 Jeff Hobbs <jeffh@ActiveState.com>
1186 2008-06-13 Jeff Hobbs <jeffh@ActiveState.com>
5091187
5101188 * win/configure, win/configure.in (TK_WIN_VERSION): Fix handling of
5111189 interim a/b versioning for manifest usage.
5211199
5221200 2008-06-12 Daniel Steffen <das@users.sourceforge.net>
5231201
524 * generic/tkPointer.c (Tk_UpdatePointer): fix failure to restore a
1202 * generic/tkPointer.c (Tk_UpdatePointer): Fix failure to restore a
5251203 global grab capture and to release the restrict window capture when
5261204 releasing a button grab. Fixes segfault due to dangling reference to
5271205 restrict window inside TkpSetCapture() implementation. [Bug 1991932]
5281206
529 * generic/ttk/ttkTreeview.c: fix warning.
530
531 * unix/tcl.m4 (SunOS-5.11): fix 64bit amd64 support with gcc & Sun cc.
1207 * generic/ttk/ttkTreeview.c: Fix warning.
1208
1209 * unix/tcl.m4 (SunOS-5.11): Fix 64bit amd64 support with gcc & Sun cc.
5321210 * unix/configure: autoconf-2.59
5331211
534 * macosx/tkMacOSXXStubs.c (Tk_ResetUserInactiveTime): use UsrActivity
1212 * macosx/tkMacOSXXStubs.c (Tk_ResetUserInactiveTime): Use UsrActivity
5351213 instead of OverallAct (which may be ignored in some circumstances).
5361214
537 * macosx/Wish.xcodeproj/project.pbxproj: add tclIORTrans.c; add tclOO
1215 * macosx/Wish.xcodeproj/project.pbxproj: Add tclIORTrans.c; add tclOO
5381216 * macosx/Wish.xcodeproj/default.pbxuser: files to tktest-X11 target;
5391217 add debug configs for 64bit and with corefoundation disabled; updates
5401218 and cleanup for Xcode 3.1 and for Leopard; sync with Tcl.xcodeproj.
541 * macosx/Wish.xcode/project.pbxproj: sync Wish.xcodeproj changes.
1219 * macosx/Wish.xcode/project.pbxproj: Sync Wish.xcodeproj changes.
5421220 * macosx/Wish.xcode/default.pbxuser:
543 * macosx/README: document new build configs.
544
545 2008-06-10 Joe English <jenglish@users.sourceforge.net>
1221 * macosx/README: Document new build configs.
1222
1223 2008-06-10 Joe English <jenglish@users.sourceforge.net>
5461224
5471225 * unix/tkUnixKey.c: Use Xutf8LookupString if available. This should
5481226 fix problems (like [Bug 1908443]) where Xlib's idea of the system
5541232 * macosx/README: debug configs with gcov;
5551233 update to Xcode 3.1.
5561234
557 2008-05-27 Pat Thoyts <patthoyts@users.sourceforge.net>
1235 2008-05-27 Pat Thoyts <patthoyts@users.sourceforge.net>
5581236
5591237 * generic/ttk/ttkTheme.c: [ttk::style theme use] without an argument
5601238 * doc/ttk_style.n: now returns the current theme.
5611239
562 2008-05-23 Joe English <jenglish@users.sourceforge.net>
1240 2008-05-23 Joe English <jenglish@users.sourceforge.net>
5631241
5641242 * doc/ttk_treeview.n, generic/ttk/ttkTreeview.c,
5651243 * generic/ttk/ttkTagSet.c, generic/ttk/ttkLayout.c,
5771255 Don't need separate 'Item', 'Cell', and 'Row' style settings anymore,
5781256 only the base "Treeview" style is used.
5791257
580 2008-05-23 Joe English <jenglish@users.sourceforge.net>
1258 2008-05-23 Joe English <jenglish@users.sourceforge.net>
5811259
5821260 * generic/ttk/ttkLabel.c: Avoid passing width or height <= 0 to
5831261 Tk_RedrawImage, as this leads to a panic on Windows. [Bug 1967576]
5841262
585 2008-05-16 Pat Thoyts <patthoyts@users.sourceforge.net>
1263 2008-05-16 Pat Thoyts <patthoyts@users.sourceforge.net>
5861264
5871265 * library/ttk/xpTheme.tcl: Add correct border to combobox on Vista
5881266
589 2008-05-15 Pat Thoyts <patthoyts@users.sourceforge.net>
1267 2008-05-15 Pat Thoyts <patthoyts@users.sourceforge.net>
5901268
5911269 * win/makefile.vc: We should use the thread allocator for threaded
5921270 * win/rules.vc: builds. Added 'tclalloc' option to disable.
5971275 (DisplayPanedWindow): Ensure that a zero width never gets fed to the
5981276 underlying window system. [Bug 1639824]
5991277
600 2008-05-13 Pat Thoyts <patthoyts@users.sourceforge.net>
1278 2008-05-13 Pat Thoyts <patthoyts@users.sourceforge.net>
6011279
6021280 * library/console.tcl: Support pixel sized font in +/- keybinding.
6031281 * tests/listbox.test: -activestyle default is underline on windows.
6041282 * tests/winDialog.test: Fixed hanging tk_chooseColor tests.
6051283
606 2008-05-11 Pat Thoyts <patthoyts@users.sourceforge.net>
1284 2008-05-11 Pat Thoyts <patthoyts@users.sourceforge.net>
6071285
6081286 * library/tk.tcl: Support for ttk widgets in AmpWidget
6091287 * doc/button.n: Note negative widths for button. [Patch 1883418]
6101288
611 2008-05-09 Pat Thoyts <patthoyts@users.sourceforge.net>
1289 2008-05-09 Pat Thoyts <patthoyts@users.sourceforge.net>
6121290
6131291 * doc/ttk_*: 'identify' widget command is on all ttk widgets.
6141292
615 2008-05-04 Joe English <jenglish@users.sourceforge.net>
1293 2008-05-04 Joe English <jenglish@users.sourceforge.net>
6161294
6171295 * macosx/ttkMacOSAquaTheme.c: "default" and "focus" adornments should
6181296 not be disjoint [Bug 1942785]
6251303 files allow building things that link against Tcl with really ancient
6261304 compilers still; the requirement is just when building Tcl itself.)
6271305
628 2008-04-25 Joe English <jenglish@users.sourceforge.net>
1306 2008-04-25 Joe English <jenglish@users.sourceforge.net>
6291307
6301308 * library/ttk/treeview.tcl: BUGFIX: [$tv selection] takes a list of
6311309 items, not a single item. [Bug 1951733]
6321310
633 2008-04-20 Pat Thoyts <patthoyts@users.sourceforge.net>
1311 2008-04-20 Pat Thoyts <patthoyts@users.sourceforge.net>
6341312
6351313 * win/makefile.vc: Include ws2_32 in the link list. [Bug 1900872]
6361314 * doc/menu.n: Minor change regarding the system menu. [Bug 1887169]
6411319 * doc/text.n: Correct description of when -relief option is ignored on
6421320 a tag. Thanks to emiliano for spotting.
6431321
644 2008-04-17 Don Porter <dgp@users.sourceforge.net>
1322 2008-04-17 Don Porter <dgp@users.sourceforge.net>
6451323
6461324 * generic/tkCanvas.c: Fix logic that determines when canvas item
6471325 <Enter> event should fire. Thanks to Sebastian Wangnick. [Bug 1327482]
6521330 * generic/tkWindow.c (Initialize): and export only a module-scope
6531331 pointer to to the main stubs table (for package init). [Patch 1938497]
6541332
655 2008-04-14 Pat Thoyts <patthoyts@users.sourceforge.net>
1333 2008-04-14 Pat Thoyts <patthoyts@users.sourceforge.net>
6561334
6571335 * win/tkWinDialog.c: Fix [tk_chooseColor -title]. [Bug 1941740]
6581336 * win/tkWinTest.c: Added parent to testgetwininfo
6621340
6631341 * generic/tkImgGIF.c: Let the GIF writer use a real LZW compressor.
6641342
665 2008-04-08 Pat Thoyts <patthoyts@users.sourceforge.net>
666
667 * win/ttkWinXpTheme.c: Provide a visual-styles API element engine
1343 2008-04-08 Pat Thoyts <patthoyts@users.sourceforge.net>
1344
1345 * win/ttkWinXpTheme.c: Provide a visual-styles API element engine
6681346 * tests/ttk/vsapi.test: to permit scripts to create any available
6691347 * doc/ttk_vsapi.n: windows xp/vista element. Plus basic tests.
6701348
6761354 * generic/tkIntXlibDecls.h:
6771355 * generic/tkPlatDecls.h:
6781356
679 2008-04-08 Kevin Kenny <kennykb@acm.org>
680
681 * tkWinEmbed.c: Removed #if 0 code. Trust the revision control system,
682 if you need it again, you can find it.
683
684 * tkWinSend.c: Added conditional compilation to silence several
685 compiler warnings.
686
687 2008-04-07 Jeff Hobbs <jeffh@ActiveState.com>
1357 2008-04-08 Kevin Kenny <kennykb@acm.org>
1358
1359 * tkWinEmbed.c: Removed #if 0 code. Trust the revision control
1360 system, if you need it again, you can find it.
1361
1362 * tkWinSend.c: Added conditional compilation to silence several
1363 compiler warnings.
1364
1365 2008-04-07 Jeff Hobbs <jeffh@ActiveState.com>
6881366
6891367 * generic/tkWindow.c (Initialize): Fix double-free on Tk_ParseArgv
6901368 * tests/main.test (main-3.*): error. [Bug 1937135]
6911369
692 * generic/tkArgv.c: fix -help mem explosion. [Bug 1936238] (kenny)
693
694 2008-04-04 Pat Thoyts <patthoyts@users.sourceforge.net>
1370 * generic/tkArgv.c: Fix -help mem explosion. [Bug 1936238] (kenny)
1371
1372 2008-04-04 Pat Thoyts <patthoyts@users.sourceforge.net>
6951373
6961374 * library/ttk/sizegrip.tcl: Don't resize if the toplevel is not
6971375 resizable or the sizegrip has been disabled.
6981376
699 2008-04-03 Pat Thoyts <patthoyts@users.sourceforge.net>
1377 2008-04-03 Pat Thoyts <patthoyts@users.sourceforge.net>
7001378
7011379 * win/makefile.vc: Fixed stubs usage
7021380 * library/ttk/xpTheme.tcl: fix the colour of labelframe in xp
7261404
7271405 * unix/configure: autoconf-2.59
7281406
729 2008-04-01 Don Porter <dgp@users.sourceforge.net>
1407 2008-04-01 Don Porter <dgp@users.sourceforge.net>
7301408
7311409 * generic/tkStubLib.c (Tk_InitStubs): Added missing error
7321410 * generic/tkWindow.c (Tk_PkgInitStubsCheck): message and removed
7611439 * generic/tkIntXlibDecls.h:
7621440 * generic/tkPlatDecls.h:
7631441
764 2008-03-28 Don Porter <dgp@users.sourceforge.net>
1442 2008-03-28 Don Porter <dgp@users.sourceforge.net>
7651443
7661444 *** 8.5.2 TAGGED FOR RELEASE ***
7671445
7771455
7781456 * changes: Updates for 8.5.2 release.
7791457
780 2008-03-27 Jeff Hobbs <jeffh@ActiveState.com>
781
782 * library/safetk.tcl (::safe::tkInterpInit): make sure tk_library and
1458 2008-03-27 Jeff Hobbs <jeffh@ActiveState.com>
1459
1460 * library/safetk.tcl (::safe::tkInterpInit): Make sure tk_library and
7831461 its subdirs (eg, ttk) are on the "safe" access path.
7841462
7851463 2008-03-27 Daniel Steffen <das@users.sourceforge.net>
7861464
787 * unix/tcl.m4 (SunOS-5.1x): fix 64bit support for Sun cc. [Bug 1921166]
1465 * unix/tcl.m4 (SunOS-5.1x): Fix 64bit support for Sun cc. [Bug
1466 1921166]
7881467
7891468 * unix/configure: autoconf-2.59
7901469
7951474 * generic/ttk/ttkDecls.h: Fix incorrect number of arguments in
7961475 Ttk_InitStubs macro definition.
7971476
798 2008-03-26 Don Porter <dgp@users.sourceforge.net>
1477 2008-03-26 Don Porter <dgp@users.sourceforge.net>
7991478
8001479 * changes: Updates for 8.5.2 release.
8011480
8021481 * unix/tkUnixCursor.c: Stop crash in [. configure -cursor] on X11.
8031482 Thanks to emiliano gavilán. [Bug 1922466]
8041483
805 2008-03-26 Joe English <jenglish@users.sourceforge.net>
1484 2008-03-26 Joe English <jenglish@users.sourceforge.net>
8061485
8071486 * generic/tkInt.h, generic/tkEvent.c, unix/tkUnixEvent.c,
8081487 * unix/tkUnixKey.c: XIM reorganization and cleanup; see
8091488 [Patch 1919791] for details.
8101489
811 2008-03-21 Joe English <jenglish@users.sourceforge.net>
1490 2008-03-21 Joe English <jenglish@users.sourceforge.net>
8121491
8131492 * generic/tk.decls, generic/ttk/ttkStubLib.c, unix/Makefile.in: Keep
8141493 ttkStubLib.o in libtkstub instead of libtk. [Bug 1920030]
8231502
8241503 * doc/GetClrmap.3: Documented Tk_PreserveColormap. [Bug 220809]
8251504
826 2008-03-17 Joe English <jenglish@users.sourceforge.net>
1505 2008-03-17 Joe English <jenglish@users.sourceforge.net>
8271506
8281507 * unix/Makefile.in, win/Makefile.in, win/makefile.vc: Put ttkStubLib.o
8291508 in libtkstub instead of libtk. [Bug 1863007]
8351514
8361515 2008-03-13 Daniel Steffen <das@users.sourceforge.net>
8371516
838 * unix/configure.in: Use backslash-quoting instead of double-quoting
839 * unix/tcl.m4: for lib paths in tkConfig.sh. [Bug 1913622]
840 * unix/configure: autoconf-2.59
841
842 2008-03-13 Don Porter <dgp@users.sourceforge.net>
1517 * unix/configure.in: Use backslash-quoting instead of double-quoting
1518 * unix/tcl.m4: for lib paths in tkConfig.sh. [Bug 1913622]
1519 * unix/configure: autoconf-2.59
1520
1521 2008-03-13 Don Porter <dgp@users.sourceforge.net>
8431522
8441523 * changes: Updates for 8.5.2 release.
8451524
8491528 * macosx/Wish.xcodeproj/default.pbxuser: CODE_SIGN_IDENTITY and
8501529 * macosx/Wish-Common.xcconfig: 'xcodebuild install'.
8511530
852 2008-03-12 Joe English <jenglish@users.sourceforge.net>
1531 2008-03-12 Joe English <jenglish@users.sourceforge.net>
8531532
8541533 * unix/tkUnixRFont.c: Try a fallback font if XftFontOpenPattern()
8551534 fails in GetFont (workaround for [Bug 1090382]).
8771556 * unix/Makefile.in (install-strip): Strip non-global symbols from
8781557 dynamic library.
8791558
880 2008-03-10 Don Porter <dgp@users.sourceforge.net>
1559 2008-03-10 Don Porter <dgp@users.sourceforge.net>
8811560
8821561 * changes: Updates for 8.5.2 release.
8831562
8851564
8861565 * doc/colors.n: Reworked to produce nicer HTML output.
8871566
888 2008-03-06 Joe English <jenglish@users.sourceforge.net>
1567 2008-03-06 Joe English <jenglish@users.sourceforge.net>
8891568
8901569 * doc/ttk_notebook.n: Move "TAB IDENTIFIERS" section above "WIDGET
8911570 COMMAND" section. [Bug 1882011]
8921571
893 2008-02-29 Pat Thoyts <patthoyts@users.sourceforge.net>
894
895 * library/demos/widget: Added a Knight's tour canvas demo.
1572 2008-02-29 Pat Thoyts <patthoyts@users.sourceforge.net>
1573
1574 * library/demos/widget: Added a Knight's tour canvas demo.
8961575 * library/demos/knightstour.tcl:
8971576
8981577 2008-02-27 Daniel Steffen <das@users.sourceforge.net>
8991578
900 * macosx/tkMacOSXDraw.c: workaround leak in Carbon SetPortPenPixPat()
1579 * macosx/tkMacOSXDraw.c: Workaround leak in Carbon SetPortPenPixPat()
9011580 API [Bug 1863346]; avoid repeated PixPat allocation/deallocation.
9021581
903 2008-02-23 Joe English <jenglish@users.sourceforge.net>
1582 2008-02-23 Joe English <jenglish@users.sourceforge.net>
9041583
9051584 * library/ttk/combobox.tcl, doc/ttk_combobox.n,
9061585 * tests/ttk/combobox.test: Arrange to deliver <<ComboboxSelected>>
9071586 event after listbox is unposted, as intended [Bug 1890211]. Clarified
9081587 documentation.
9091588
910 2008-02-23 Joe English <jenglish@users.sourceforge.net>
1589 2008-02-23 Joe English <jenglish@users.sourceforge.net>
9111590
9121591 * generic/ttk/ttkPanedWindow.c: Don't enforce minimum sash thickness
9131592 of 5 pixels, just use 5 as a default. [FR 1898288]
9201599
9211600 * doc/ttk_scale.n (new file): Added basic documentation. [Bug 1881925]
9221601
923 2008-02-04 Don Porter <dgp@users.sourceforge.net>
1602 2008-02-04 Don Porter <dgp@users.sourceforge.net>
9241603
9251604 *** 8.5.1 TAGGED FOR RELEASE ***
9261605
9401619
9411620 2008-02-02 Daniel Steffen <das@users.sourceforge.net>
9421621
943 * macosx/Wish-Info.plist.in: add CFBundleLocalizations key, listing
944 * unix/configure.in (Darwin): all library/msgs locales.
945
946 * unix/configure.in (Darwin): correct Info.plist year substitution in
947 non-framework builds.
1622 * macosx/Wish-Info.plist.in: Add CFBundleLocalizations key, listing
1623 * unix/configure.in (Darwin): all library/msgs locales.
1624
1625 * unix/configure.in (Darwin): Correct Info.plist year substitution
1626 in non-framework builds.
9481627
9491628 * unix/configure: autoconf-2.59
9501629
951 2008-02-01 Don Porter <dgp@users.sourceforge.net>
1630 2008-02-01 Don Porter <dgp@users.sourceforge.net>
9521631
9531632 * changes: Updates for 8.5.1 release.
9541633
9571636 * generic/tkImgGIF.c: Fixed a buffer overflow (CVE-2008-0553).
9581637 * tests/imgPhoto.test: Added a test for the above.
9591638
960 2008-01-31 Jeff Hobbs <jeffh@ActiveState.com>
961
962 * library/msgbox.tcl (::tk::MessageBox): don't use ttk::label in low
1639 2008-01-31 Jeff Hobbs <jeffh@ActiveState.com>
1640
1641 * library/msgbox.tcl (::tk::MessageBox): Don't use ttk::label in low
9631642 depth/aqua fallback, as it doesn't support -bitmap.
9641643
965 * win/tkWinDialog.c (Tk_MessageBoxObjCmd): pass "" instead of NULL
1644 * win/tkWinDialog.c (Tk_MessageBoxObjCmd): Pass "" instead of NULL
9661645 when -title isn't set. [Bug 1881892]
9671646
9681647 2008-01-31 Donal K. Fellows <donal.k.fellows@man.ac.uk>
9751654 * doc/canvas.n, doc/listbox.n, doc/message.n: Fix erroneous listing of
9761655 "standard" options. [Bug 1882495]
9771656
978 2008-01-29 Joe English <jenglish@users.sourceforge.net>
1657 2008-01-29 Joe English <jenglish@users.sourceforge.net>
9791658
9801659 * library/treeview.tcl: Fix bug in Shift-ButtonPress-1 binding (error
9811660 if no current focus item; reported on c.l.t.)
9861665 Ttk manual pages so that they are documented in the correct location.
9871666 [Bug 1876493]
9881667
989 2008-01-28 Joe English <jenglish@users.sourceforge.net>
1668 2008-01-28 Joe English <jenglish@users.sourceforge.net>
9901669
9911670 * unix/tkUnixRFont.c: Re-fix strict-aliasing warnings reintroduced by
9921671 last patch.
9931672
994 2008-01-27 Joe English <jenglish@users.sourceforge.net>
1673 2008-01-27 Joe English <jenglish@users.sourceforge.net>
9951674
9961675 * generic/ttk/ttkNotebook.c: Make sure to schedule a redisplay when
9971676 adding and/or hiding tabs. [Bug 1878298]
9981677
999 2008-01-27 Joe English <jenglish@users.sourceforge.net>
1678 2008-01-27 Joe English <jenglish@users.sourceforge.net>
10001679
10011680 * unix/tkUnixRFont.c: Merged common code from InitFont() and
10021681 TkpGetFontAttrsForChar(), factored into GetTkFontAttributes() and
10051684 TkFontAttributes.family member is a Tk_Uid, as specified. Use
10061685 FcTypeDouble for XFT_SIZE attribute. Finally: fix [Bug 1835848]
10071686
1008 2008-01-25 Don Porter <dgp@users.sourceforge.net>
1687 2008-01-25 Don Porter <dgp@users.sourceforge.net>
10091688
10101689 * changes: Updates for 8.5.1 release.
10111690
1012 2008-01-08 Joe English <jenglish@users.sourceforge.net>
1691 2008-01-08 Joe English <jenglish@users.sourceforge.net>
10131692
10141693 * generic/ttk/ttkFrame.c: BUGFIX: fix crash in [ttk::labelframe] when
10151694 -style option specified. [Bug 1867122]
10161695
1017 2008-01-08 Joe English <jenglish@users.sourceforge.net>
1696 2008-01-08 Joe English <jenglish@users.sourceforge.net>
10181697
10191698 * win/ttkWinTheme.c: Add tristate support to checkbuttons and
10201699 radiobuttons. [Bug 1865898]
10211700 Fix check and radio indicator size. [Bug 1679067]
10221701
1023 2008-01-06 Joe English <jenglish@users.sourceforge.net>
1702 2008-01-06 Joe English <jenglish@users.sourceforge.net>
10241703
10251704 * generic/ttk/ttkWidget.c, generic/ttk/ttkWidget.h: Call
10261705 Tk_MakeWindowExist() in widget constructor. Removed now-unnecessary
10271706 initial ConfigureNotify processing.
10281707
1029 2008-01-06 Joe English <jenglish@users.sourceforge.net>
1708 2008-01-06 Joe English <jenglish@users.sourceforge.net>
10301709
10311710 * library/ttk/treeview.tcl, library/ttk/utils.tcl: Fix MouseWheel
10321711 bindings for ttk::treeview widget. [Bugs 1442006, 1821939, 1862692]
10331712
1034 2008-01-02 Don Porter <dgp@users.sourceforge.net>
1713 2008-01-02 Don Porter <dgp@users.sourceforge.net>
10351714
10361715 * generic/tk.h: Bump version number to 8.5.1b1 to distinguish
10371716 * library/tk.tcl: CVS development snapshots from the 8.5.0 and
00 README: Tk
1 This is the Tk 8.6a3 source distribution.
1 This is the Tk 8.6b1 source distribution.
22 Tcl/Tk is also available through NetCVS:
33 http://tcl.sourceforge.net/
44 You can get any source release of Tcl from the file distributions
55 link at the above URL.
66
7 RCS: @(#) $Id: README,v 1.57 2008/08/28 16:29:34 dgp Exp $
7 RCS: @(#) $Id: README,v 1.59 2008/12/19 14:32:25 dgp Exp $
88
99 1. Introduction
1010 ---------------
11 released on March 13, 1991. Changes that aren't backward compatible
22 are marked specially.
33
4 RCS: @(#) $Id: changes,v 1.136 2008/10/10 21:30:21 dgp Exp $
4 RCS: @(#) $Id: changes,v 1.137 2008/12/19 19:58:50 dgp Exp $
55
66 3/16/91 (bug fix) Modified tkWindow.c to remove Tk's Tcl commands from
77 the interpreter when the main window is deleted (otherwise there will
65736573 *** POTENTIAL INCOMPATIBILITY ***
65746574
65756575 --- Released 8.6a3, October 10, 2008 --- See ChangeLog for details ---
6576
6577 2008-10-17 (enhancement) keyboard bindings for ttk::scale (thoyts)
6578
6579 2008-10-18 (bug fix)[1825353] Russian Windows tiny fonts problem (thoyts)
6580
6581 2008-10-18 (new feature)[TIP 321] [tk busy] (decoster,fellows)
6582
6583 2008-10-28 (bug fix)[1534835,2054562] use of more correct cursors (english)
6584
6585 2008-11-01 (new feature) New [ttk::spinbox] widget (thoyts)
6586
6587 2008-11-01 (new feature)[TIP 97] [$canvas imove] [$canvas rchars] (fellows)
6588
6589 2008-11-09 (bug fix)[2207435] [ttk::entry .t -textvar ::noexist::x] (english)
6590
6591 2008-11-11 (bug fix)[2312027] Tk_Create*ImageType() thread safety (nijtmans)
6592
6593 2008-11-11 (bug fix)[2264732] crash using nondefault visual (english)
6594
6595 2008-11-12 (bug fix)[1777362] permit [text] names containing "-" (thoyts)
6596
6597 2008-11-14 (bug fix)[2239034] limit [wm manage] to Frames (thoyts)
6598
6599 2008-11-22 (new feature)[TIP 119] -angle option for canvas text items (fellows)
6600
6601 2008-11-22 (bug fix)[1939129,1991930] combobox behind other windows (thoyts)
6602
6603 2008-11-22 (new feature) Demo ctext.tcl now demos angled text (fellows)
6604
6605 2008-11-23 (bug fix)[1389270] made [event generate <Focus*>] work (thoyts)
6606
6607 2008-11-28 (bug fix)[1813597,2218964] eliminate unnecessary units conversion
6608 in screen distances, reducing precision loss (ferrieux)
6609
6610 2008-12-03 (enhancement) new "hover" state for proper Vista visuals (thoyts)
6611
6612 2008-12-05 (bug fix)[2107938] no negative font size in PS (fellows)
6613
6614 2008-12-05 (enhancement) new "vista" theme (thoyts)
6615
6616 2008-12-06 (new feature)[TIP 197] [$text -insertunfocussed] (edwards,fellows)
6617
6618 2008-12-06 (new feature)[TIP 337] handle non-error bg exceptions (porter)
6619
6620 2008-12-10 (new feature)[TIP 324] [tk fontchooser](thoyts,vetter,robert,steffen)
6621
6622 2008-12-12 (new feature) Demo fontchoose.tcl demos [tk fontchooser] (thoyts)
6623
6624 2008-12-18 (enhancement)[24442309] Updated German messages (haertel)
6625
6626 --- Released 8.6b1, December 19, 2008 --- See ChangeLog for details ---
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: CanvTkwin.3,v 1.8 2008/06/30 22:57:00 dkf Exp $
6 '\" RCS: @(#) $Id: CanvTkwin.3,v 1.9 2008/11/01 12:25:14 dkf Exp $
77 '\"
88 .so man.macros
99 .TH Tk_CanvasTkwin 3 4.1 Tk "Tk Library Procedures"
8686 If \fIstring\fR is a valid coordinate description then \fBTk_CanvasGetCoord\fR
8787 stores the corresponding canvas coordinate at *\fIdoublePtr\fR
8888 and returns \fBTCL_OK\fR.
89 Otherwise it stores an error message in \fIinterp->result\fR and
89 Otherwise it stores an error message in the interpreter result and
9090 returns \fBTCL_ERROR\fR.
9191 .PP
9292 \fBTk_CanvasDrawableCoords\fR is called by type managers during
142142 directly, but will use their addresses to create a \fBTk_CustomOption\fR
143143 structure for the \fB\-tags\fR option. The code typically looks
144144 like this:
145 .PP
145146 .CS
146147 static Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
147148 Tk_CanvasTagsPrintProc, (ClientData) NULL
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: ConfigWidg.3,v 1.21 2008/06/30 22:57:00 dkf Exp $
7 '\" RCS: @(#) $Id: ConfigWidg.3,v 1.22 2008/10/30 21:39:16 nijtmans Exp $
88 '\"
99 .so man.macros
1010 .TH Tk_ConfigureWidget 3 4.1 Tk "Tk Library Procedures"
110110 char *\fIdefValue\fR;
111111 int \fIoffset\fR;
112112 int \fIspecFlags\fR;
113 Tk_CustomOption *\fIcustomPtr\fR;
113 const Tk_CustomOption *\fIcustomPtr\fR;
114114 } \fBTk_ConfigSpec\fR;
115115 .CE
116116 The \fItype\fR field indicates what type of configuration option this is
556556 char *\fIwidgRec\fR,
557557 int \fIoffset\fR);
558558
559 typedef char *\fBTk_OptionPrintProc\fR(
559 typedef const char *\fBTk_OptionPrintProc\fR(
560560 ClientData \fIclientData\fR,
561561 Tk_Window \fItkwin\fR,
562562 char *\fIwidgRec\fR,
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: CrtImgType.3,v 1.14 2008/06/30 22:57:01 dkf Exp $
7 '\" RCS: @(#) $Id: CrtImgType.3,v 1.16 2008/11/12 00:15:26 nijtmans Exp $
88 '\"
99 .so man.macros
1010 .TH Tk_CreateImageType 3 8.5 Tk "Tk Library Procedures"
2222 .sp
2323 \fBTk_InitImageArgs\fR(\fIinterp, argc, argvPtr\fR)
2424 .SH ARGUMENTS
25 .AS Tk_ImageType *typePtrPtr
26 .AP Tk_ImageType *typePtr in
25 .AS "const Tk_ImageType" *typePtrPtr
26 .AP "const Tk_ImageType" *typePtr in
2727 Structure that defines the new type of image.
28 Must be static: a
28 For Tk 8.4 and earlier this must be static: a
2929 pointer to this structure is retained by the image code.
30 In Tk 8.5, this limitation was relaxed.
3031 .AP Tcl_Interp *interp in
3132 Interpreter in which image was created.
3233 .AP "const char" *name in
5960 by the image manager to deal with images of this type:
6061 .CS
6162 typedef struct Tk_ImageType {
62 char *\fIname\fR;
63 const char *\fIname\fR;
6364 Tk_ImageCreateProc *\fIcreateProc\fR;
6465 Tk_ImageGetProc *\fIgetProc\fR;
6566 Tk_ImageDisplayProc *\fIdisplayProc\fR;
109110 .CS
110111 typedef int \fBTk_ImageCreateProc\fR(
111112 Tcl_Interp *\fIinterp\fR,
112 char *\fIname\fR,
113 const char *\fIname\fR,
113114 int \fIobjc\fR,
114115 Tcl_Obj *const \fIobjv\fR[],
115 Tk_ImageType *\fItypePtr\fR,
116 const Tk_ImageType *\fItypePtr\fR,
116117 Tk_ImageMaster \fImaster\fR,
117118 ClientData *\fImasterDataPtr\fR);
118119 .CE
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: CrtItemType.3,v 1.13 2008/06/30 22:57:01 dkf Exp $
6 '\" RCS: @(#) $Id: CrtItemType.3,v 1.14 2008/11/01 17:26:36 dkf Exp $
77 '\"
88 .so man.macros
99 .TH Tk_CreateItemType 3 4.0 Tk "Tk Library Procedures"
4545 .PP
4646 You may find it easier to understand the rest of this manual entry
4747 by looking at the code for an existing canvas item type such as
48 bitmap (file tkCanvBmap.c) or text (tkCanvText.c).
48 bitmap (in the file tkCanvBmap.c) or text (tkCanvText.c).
4949 The easiest way to create a new type manager is to copy the code
5050 for an existing type and modify it for the new type.
5151 .PP
6161 The first data structure is a Tk_ItemType; it contains
6262 information such as the name of the type and pointers to
6363 the standard procedures implemented by the type manager:
64 .PP
6465 .CS
6566 typedef struct Tk_ItemType {
6667 char *\fIname\fR;
9394 except \fInextPtr\fR, which Tk sets to link all the types together
9495 into a list.
9596 The structure must be in permanent memory (either statically
96 allocated or dynamically allocated but never freed); Tk retains
97 allocated or dynamically allocated but never freed); Tk retains
9798 a pointer to this structure.
9899 .PP
99100 The second data structure manipulated by a type manager is an
103104 the same structure, but different types usually have different
104105 formats for their item records.
105106 The first part of each item record is a header with a standard structure
106 defined by Tk via the type Tk_Item; the rest of the item
107 defined by Tk via the type Tk_Item; the rest of the item
107108 record is defined by the type manager.
108109 A type manager must define its item records with a Tk_Item as
109110 the first field.
110111 For example, the item record for bitmap items is defined as follows:
112 .PP
111113 .CS
112114 typedef struct BitmapItem {
113115 Tk_Item \fIheader\fR;
119121 GC \fIgc\fR;
120122 } \fBBitmapItem\fR;
121123 .CE
124 .PP
122125 The \fIheader\fR substructure contains information used by Tk
123126 to manage the item, such as its identifier, its tags, its type,
124127 and its bounding box.
128131 fields in the header except for four fields
129132 whose names are \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR.
130133 These fields give a bounding box for the items using integer
131 canvas coordinates: the item should not cover any pixels
134 canvas coordinates: the item should not cover any pixels
132135 with x-coordinate lower than \fIx1\fR or y-coordinate
133136 lower than \fIy1\fR, nor should it cover any pixels with
134137 x-coordinate greater than or equal to \fIx2\fR or y-coordinate
138141 .PP
139142 Whenever Tk calls a procedure in a type manager it passes in a pointer
140143 to an item record.
141 The argument is always passed as a pointer to a Tk_Item; the type
144 The argument is always passed as a pointer to a Tk_Item; the type
142145 manager will typically cast this into a pointer to its own specific
143146 type, such as BitmapItem.
144147 .PP
145148 The third data structure used by type managers has type
146 Tk_Canvas; it serves as an opaque handle for the canvas widget
149 Tk_Canvas; it serves as an opaque handle for the canvas widget
147150 as a whole.
148151 Type managers need not know anything about the contents of this
149152 structure.
151154 procedures of a type manager, and the type manager can pass the
152155 handle back to library procedures such as Tk_CanvasTkwin
153156 to fetch information about the canvas.
157 .SH "TK_ITEMTYPE FIELDS"
154158 .SS NAME
155159 .PP
156160 This section and the ones that follow describe each of the fields
161165 type.
162166 If there already existed an item type by this name then
163167 the new item type replaces the old one.
168 .SS "FLAGS (IN ALWAYSREDRAW)"
169 .PP
170 The \fItypePtr\->alwaysRedraw\fR field (so named for historic reasons)
171 contains a collection of flag bits that modify how the canvas core interacts
172 with the item. The following bits are defined:
173 .TP
174 \fB1\fR
175 .
176 Indicates that the item should always be redrawn when any part of the canvas
177 is redrawn, rather than only when the bounding box of the item overlaps the
178 area being redrawn. This is used by window items, for example, which need to
179 unmap subwindows that are not on the screen.
180 .TP
181 \fBTK_CONFIG_OBJS\fR
182 .
183 Indicates that operations which would otherwise take a string (or array of
184 strings) actually take a Tcl_Obj reference (or an array of such references).
185 The operations to which this applies are the \fIconfigProc\fR, the
186 \fIcoordProc\fR, the \fIcreateProc\fR, the \fIindexProc\fR and the
187 \fIinsertProc\fR.
188 .TP
189 \fBTK_MOVABLE_POINTS\fR
190 .VS 8.6
191 Indicates that the item supports the \fIdCharsProc\fR, \fIindexProc\fR and
192 \fIinsertProc\fR with the same semantics as Tk's built-in line and polygon
193 types, and that hence individual coordinate points can be moved. Must not be
194 set if any of the above methods is NULL.
195 .VE 8.6
164196 .SS ITEMSIZE
165197 .PP
166 \fItypePtr->itemSize\fR gives the size in bytes of item records
198 \fItypePtr\->itemSize\fR gives the size in bytes of item records
167199 of this type, including the Tk_Item header.
168200 Tk uses this size to allocate memory space for items of the type.
169201 All of the item records for a given type must have the same size.
172204 object of variable length and keep a pointer to it in the item record.
173205 .SS CREATEPROC
174206 .PP
175 \fItypePtr->createProc\fR points to a procedure for
207 \fItypePtr\->createProc\fR points to a procedure for
176208 Tk to call whenever a new item of this type is created.
177 \fItypePtr->createProc\fR must match the following prototype:
209 \fItypePtr\->createProc\fR must match the following prototype:
210 .PP
178211 .CS
179212 typedef int \fBTk_ItemCreateProc\fR(
180213 Tcl_Interp *\fIinterp\fR,
181214 Tk_Canvas \fIcanvas\fR,
182215 Tk_Item *\fIitemPtr\fR,
183216 int \fIobjc\fR,
184 Tcl_Obj* const \fIobjv\fR[]);
185 .CE
217 Tcl_Obj *const \fIobjv\fR[]);
218 .CE
219 .PP
186220 The \fIinterp\fR argument is the interpreter in which the canvas's
187221 \fBcreate\fR widget command was invoked, and \fIcanvas\fR is a
188222 handle for the canvas widget.
189223 \fIitemPtr\fR is a pointer to a newly-allocated item of
190 size \fItypePtr->itemSize\fR.
224 size \fItypePtr\->itemSize\fR.
191225 Tk has already initialized the item's header (the first
192226 \fBsizeof(Tk_ItemType)\fR bytes).
193227 The \fIobjc\fR and \fIobjv\fR arguments describe all of the
194228 arguments to the \fBcreate\fR command after the \fItype\fR
195229 argument.
196 For example, in the widget command
230 Note that if \fBTK_CONFIG_OBJS\fR is not set in the
231 \fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually
232 contain a pointer to an array of constant strings.
233 For example, in the widget command:
234 .PP
197235 .CS
198236 \fB\&.c create rectangle 10 20 50 50 \-fill black\fR
199237 .CE
238 .PP
200239 \fIobjc\fR will be \fB6\fR and \fIobjv\fR[0] will contain the
201240 integer object \fB10\fR.
202241 .PP
204243 the type-specific parts of the item record and set an initial value
205244 for the bounding box in the item's header.
206245 It should return a standard Tcl completion code and leave an
207 error message in \fIinterp->result\fR if an error occurs.
246 error message in the interpreter result if an error occurs.
208247 If an error occurs Tk will free the item record, so \fIcreateProc\fR
209248 must be sure to leave the item record in a clean state if it returns an error
210249 (e.g., it must free any additional memory that it allocated for
214253 Each type manager must provide a standard table describing its
215254 configuration options, in a form suitable for use with
216255 \fBTk_ConfigureWidget\fR.
217 This table will normally be used by \fItypePtr->createProc\fR
218 and \fItypePtr->configProc\fR, but Tk also uses it directly
256 This table will normally be used by \fItypePtr\->createProc\fR
257 and \fItypePtr\->configProc\fR, but Tk also uses it directly
219258 to retrieve option information in the \fBitemcget\fR and
220259 \fBitemconfigure\fR widget commands.
221 \fItypePtr->configSpecs\fR must point to the configuration table
260 \fItypePtr\->configSpecs\fR must point to the configuration table
222261 for this type.
223262 Note: Tk provides a custom option type \fBtk_CanvasTagsOption\fR
224 for implementing the \fB\-tags\fR option; see an existing type
263 for implementing the \fB\-tags\fR option; see an existing type
225264 manager for an example of how to use it in \fIconfigSpecs\fR.
226265 .SS CONFIGPROC
227266 .PP
228 \fItypePtr->configProc\fR is called by Tk whenever the
267 \fItypePtr\->configProc\fR is called by Tk whenever the
229268 \fBitemconfigure\fR widget command is invoked to change the
230269 configuration options for a canvas item.
231270 This procedure must match the following prototype:
271 .PP
232272 .CS
233273 typedef int \fBTk_ItemConfigureProc\fR(
234274 Tcl_Interp *\fIinterp\fR,
235275 Tk_Canvas \fIcanvas\fR,
236276 Tk_Item *\fIitemPtr\fR,
237277 int \fIobjc\fR,
238 Tcl_Obj* const \fIobjv\fR[],
278 Tcl_Obj *const \fIobjv\fR[],
239279 int \fIflags\fR);
240280 .CE
281 .PP
241282 The \fIinterp\fR objument identifies the interpreter in which the
242 widget command was invoked, \fIcanvas\fR is a handle for the canvas
283 widget command was invoked, \fIcanvas\fR is a handle for the canvas
243284 widget, and \fIitemPtr\fR is a pointer to the item being configured.
244 \fIobjc\fR and \fIobjv\fR contain the configuration options. For
245 example, if the following command is invoked:
285 \fIobjc\fR and \fIobjv\fR contain the configuration options.
286 Note that if \fBTK_CONFIG_OBJS\fR is not set in the
287 \fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually
288 contain a pointer to an array of constant strings.
289 For example, if the following command is invoked:
290 .PP
246291 .CS
247292 \fB\&.c itemconfigure 2 \-fill red \-outline black\fR
248293 .CE
294 .PP
249295 \fIobjc\fR is \fB4\fR and \fIobjv\fR contains the string objects \fB\-fill\fR
250296 through \fBblack\fR.
251297 \fIobjc\fR will always be an even value.
252 The \fIflags\fR argument contains flags to pass to \fBTk_ConfigureWidget\fR;
298 The \fIflags\fR argument contains flags to pass to \fBTk_ConfigureWidget\fR;
253299 currently this value is always \fBTK_CONFIG_ARGV_ONLY\fR when Tk
254 invokes \fItypePtr->configProc\fR, but the type manager's \fIcreateProc\fR
300 invokes \fItypePtr\->configProc\fR, but the type manager's \fIcreateProc\fR
255301 procedure will usually invoke \fIconfigProc\fR with different flag values.
256302 .PP
257 \fItypePtr->configProc\fR returns a standard Tcl completion code and
258 leaves an error message in \fIinterp->result\fR if an error occurs.
303 \fItypePtr\->configProc\fR returns a standard Tcl completion code and
304 leaves an error message in the interpreter result if an error occurs.
259305 It must update the item's bounding box to reflect the new configuration
260306 options.
261307 .SS COORDPROC
262308 .PP
263 \fItypePtr->coordProc\fR is invoked by Tk to implement the \fBcoords\fR
309 \fItypePtr\->coordProc\fR is invoked by Tk to implement the \fBcoords\fR
264310 widget command for an item.
265311 It must match the following prototype:
312 .PP
266313 .CS
267314 typedef int \fBTk_ItemCoordProc\fR(
268315 Tcl_Interp *\fIinterp\fR,
269316 Tk_Canvas \fIcanvas\fR,
270317 Tk_Item *\fIitemPtr\fR,
271318 int \fIobjc\fR,
272 Tcl_Obj* const \fIobjv\fR[]);
273 .CE
319 Tcl_Obj *const \fIobjv\fR[]);
320 .CE
321 .PP
274322 The arguments \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR
275323 all have the standard meanings, and \fIobjc\fR and \fIobjv\fR
276324 describe the coordinate arguments.
325 Note that if \fBTK_CONFIG_OBJS\fR is not set in the
326 \fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually
327 contain a pointer to an array of constant strings.
277328 For example, if the following widget command is invoked:
329 .PP
278330 .CS
279331 \fB\&.c coords 2 30 90\fR
280332 .CE
333 .PP
281334 \fIobjc\fR will be \fB2\fR and \fBobjv\fR will contain the integer objects
282335 \fB30\fR and \fB90\fR.
283336 .PP
286339 box in the item's header), and return a standard Tcl completion
287340 code.
288341 If an error occurs, \fIcoordProc\fR must leave an error message in
289 \fIinterp->result\fR.
342 the interpreter result.
290343 .SS DELETEPROC
291344 .PP
292 \fItypePtr->deleteProc\fR is invoked by Tk to delete an item
345 \fItypePtr\->deleteProc\fR is invoked by Tk to delete an item
293346 and free any resources allocated to it.
294347 It must match the following prototype:
348 .PP
295349 .CS
296350 typedef void \fBTk_ItemDeleteProc\fR(
297351 Tk_Canvas \fIcanvas\fR,
298352 Tk_Item *\fIitemPtr\fR,
299353 Display *\fIdisplay\fR);
300354 .CE
355 .PP
301356 The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual
302357 interpretations, and \fIdisplay\fR identifies the X display containing
303358 the canvas.
304359 \fIdeleteProc\fR must free up any resources allocated for the item,
305360 so that Tk can free the item record.
306 \fIdeleteProc\fR should not actually free the item record; this will
361 \fIdeleteProc\fR should not actually free the item record; this will
307362 be done by Tk when \fIdeleteProc\fR returns.
308 .SS "DISPLAYPROC AND ALWAYSREDRAW"
309 .PP
310 \fItypePtr->displayProc\fR is invoked by Tk to redraw an item
363 .SS "DISPLAYPROC"
364 .PP
365 \fItypePtr\->displayProc\fR is invoked by Tk to redraw an item
311366 on the screen.
312367 It must match the following prototype:
368 .PP
313369 .CS
314370 typedef void \fBTk_ItemDisplayProc\fR(
315371 Tk_Canvas \fIcanvas\fR,
321377 int \fIwidth\fR,
322378 int \fIheight\fR);
323379 .CE
380 .PP
324381 The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning.
325382 \fIdisplay\fR identifies the display containing the canvas, and
326383 \fIdst\fR specifies a drawable in which the item should be rendered;
342399 .PP
343400 Normally an item's \fIdisplayProc\fR is only invoked if the item
344401 overlaps the area being displayed.
345 However, if \fItypePtr->alwaysRedraw\fR has a non-zero value, then
346 \fIdisplayProc\fR is invoked during every redisplay operation,
347 even if the item does not overlap the area of redisplay.
348 \fIalwaysRedraw\fR should normally be set to 0; it is only
349 set to 1 in special cases such as window items that need to be
350 unmapped when they are off-screen.
402 However, if bit zero of \fItypePtr\->alwaysRedraw\fR is 1,
403 (i.e.\|
404 .QW "\fItypePtr\->alwaysRedraw & 1 == 1\fR" )
405 then \fIdisplayProc\fR is invoked during every redisplay operation,
406 even if the item does not overlap the area of redisplay; this is useful for
407 cases such as window items, where the subwindow needs to be unmapped when it
408 is off the screen.
351409 .SS POINTPROC
352410 .PP
353 \fItypePtr->pointProc\fR is invoked by Tk to find out how close
411 \fItypePtr\->pointProc\fR is invoked by Tk to find out how close
354412 a given point is to a canvas item.
355413 Tk uses this procedure for purposes such as locating the item
356414 under the mouse or finding the closest item to a given point.
357415 The procedure must match the following prototype:
416 .PP
358417 .CS
359418 typedef double \fBTk_ItemPointProc\fR(
360419 Tk_Canvas \fIcanvas\fR,
361420 Tk_Item *\fIitemPtr\fR,
362421 double *\fIpointPtr\fR);
363422 .CE
423 .PP
364424 \fIcanvas\fR and \fIitemPtr\fR have the usual meaning.
365425 \fIpointPtr\fR points to an array of two numbers giving
366426 the x and y coordinates of a point.
369429 the item.
370430 .SS AREAPROC
371431 .PP
372 \fItypePtr->areaProc\fR is invoked by Tk to find out the relationship
432 \fItypePtr\->areaProc\fR is invoked by Tk to find out the relationship
373433 between an item and a rectangular area.
374434 It must match the following prototype:
435 .PP
375436 .CS
376437 typedef int \fBTk_ItemAreaProc\fR(
377438 Tk_Canvas \fIcanvas\fR,
378439 Tk_Item *\fIitemPtr\fR,
379440 double *\fIrectPtr\fR);
380441 .CE
442 .PP
381443 \fIcanvas\fR and \fIitemPtr\fR have the usual meaning.
382444 \fIrectPtr\fR points to an array of four real numbers;
383445 the first two give the x and y coordinates of the upper left
388450 outside the area, and 1 if it lies entirely inside the area.
389451 .SS POSTSCRIPTPROC
390452 .PP
391 \fItypePtr->postscriptProc\fR is invoked by Tk to generate
453 \fItypePtr\->postscriptProc\fR is invoked by Tk to generate
392454 Postscript for an item during the \fBpostscript\fR widget command.
393455 If the type manager is not capable of generating Postscript then
394 \fItypePtr->postscriptProc\fR should be NULL.
395 The procedure must match the following prototype:
456 \fItypePtr\->postscriptProc\fR should be NULL.
457 The procedure must match the following prototype:
458 .PP
396459 .CS
397460 typedef int \fBTk_ItemPostscriptProc\fR(
398461 Tcl_Interp *\fIinterp\fR,
400463 Tk_Item *\fIitemPtr\fR,
401464 int \fIprepass\fR);
402465 .CE
466 .PP
403467 The \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR arguments all have
404 standard meanings; \fIprepass\fR will be described below.
468 standard meanings; \fIprepass\fR will be described below.
405469 If \fIpostscriptProc\fR completes successfully, it should append
406 Postscript for the item to the information in \fIinterp->result\fR
470 Postscript for the item to the information in the interpreter result
407471 (e.g. by calling \fBTcl_AppendResult\fR, not \fBTcl_SetResult\fR)
408472 and return \fBTCL_OK\fR.
409473 If an error occurs, \fIpostscriptProc\fR should clear the result
410 and replace its contents with an error message; then it should
474 and replace its contents with an error message; then it should
411475 return \fBTCL_ERROR\fR.
412476 .PP
413477 Tk provides a collection of utility procedures to simplify
429493 Structuring Conventions, Tk actually generates Postscript in two passes.
430494 It calls each item's \fIpostscriptProc\fR in each pass.
431495 The only purpose of the first pass is to collect font information
432 (which is done by \fBTk_CanvasPsFont\fR); the actual Postscript is
496 (which is done by \fBTk_CanvasPsFont\fR); the actual Postscript is
433497 discarded.
434498 Tk sets the \fIprepass\fR argument to \fIpostscriptProc\fR to 1
435 during the first pass; the type manager can use \fIprepass\fR to skip
499 during the first pass; the type manager can use \fIprepass\fR to skip
436500 all Postscript generation except for calls to \fBTk_CanvasPsFont\fR.
437501 During the second pass \fIprepass\fR will be 0, so the type manager
438502 must generate complete Postscript.
439503 .SS SCALEPROC
440504 .PP
441 \fItypePtr->scaleProc\fR is invoked by Tk to rescale a canvas item
505 \fItypePtr\->scaleProc\fR is invoked by Tk to rescale a canvas item
442506 during the \fBscale\fR widget command.
443507 The procedure must match the following prototype:
508 .PP
444509 .CS
445510 typedef void \fBTk_ItemScaleProc\fR(
446511 Tk_Canvas \fIcanvas\fR,
450515 double \fIscaleX\fR,
451516 double \fIscaleY\fR);
452517 .CE
518 .PP
453519 The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning.
454520 \fIoriginX\fR and \fIoriginY\fR specify an origin relative to which
455521 the item is to be scaled, and \fIscaleX\fR and \fIscaleY\fR give the
457523 The item should adjust its coordinates so that a point in the item
458524 that used to have coordinates \fIx\fR and \fIy\fR will have new
459525 coordinates \fIx\(fm\fR and \fIy\(fm\fR, where
460 .CS
461 \fIx\(fm = originX + scaleX*(x-originX)
462 y\(fm = originY + scaleY*(y-originY)\fR
463 .CE
526 .PP
527 .CS
528 \fIx\(fm\fR = \fIoriginX\fR + \fIscaleX\fR \(mu (\fIx\fR \(mi \fIoriginX\fR)
529 \fIy\(fm\fR = \fIoriginY\fR + \fIscaleY\fR \(mu (\fIy\fR \(mi \fIoriginY\fR)
530 .CE
531 .PP
464532 \fIscaleProc\fR must also update the bounding box in the item's
465533 header.
466534 .SS TRANSLATEPROC
467535 .PP
468 \fItypePtr->translateProc\fR is invoked by Tk to translate a canvas item
536 \fItypePtr\->translateProc\fR is invoked by Tk to translate a canvas item
469537 during the \fBmove\fR widget command.
470538 The procedure must match the following prototype:
539 .PP
471540 .CS
472541 typedef void \fBTk_ItemTranslateProc\fR(
473542 Tk_Canvas \fIcanvas\fR,
475544 double \fIdeltaX\fR,
476545 double \fIdeltaY\fR);
477546 .CE
547 .PP
478548 The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning,
479549 and \fIdeltaX\fR and \fIdeltaY\fR give the amounts that should be
480550 added to each x and y coordinate within the item.
482552 update the bounding box in the item's header.
483553 .SS INDEXPROC
484554 .PP
485 \fItypePtr->indexProc\fR is invoked by Tk to translate a string
555 \fItypePtr\->indexProc\fR is invoked by Tk to translate a string
486556 index specification into a numerical index, for example during the
487557 \fBindex\fR widget command.
488 It is only relevant for item types that support indexable text;
489 \fItypePtr->indexProc\fR may be specified as NULL for non-textual
490 item types.
491 The procedure must match the following prototype:
558 It is only relevant for item types that support indexable text or coordinates;
559 \fItypePtr\->indexProc\fR may be specified as NULL for non-textual
560 item types if they do not support detailed coordinate addressing.
561 The procedure must match the following prototype:
562 .PP
492563 .CS
493564 typedef int \fBTk_ItemIndexProc\fR(
494565 Tcl_Interp *\fIinterp\fR,
495566 Tk_Canvas \fIcanvas\fR,
496567 Tk_Item *\fIitemPtr\fR,
497 char \fIindexString\fR,
568 char *\fIindexString\fR,
498569 int *\fIindexPtr\fR);
499570 .CE
571 .PP
500572 The \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR arguments all
501573 have the usual meaning.
502574 \fIindexString\fR contains a textual description of an index,
503575 and \fIindexPtr\fR points to an integer value that should be
504576 filled in with a numerical index.
577 Note that if \fBTK_CONFIG_OBJS\fR is set in the
578 \fItypePtr\->alwaysRedraw\fR field, the \fIindexString\fR parameter will
579 actually contain a Tcl_Obj reference.
505580 It is up to the type manager to decide what forms of index
506 are supported (e.g., numbers, \fBinsert\fR, \fBsel.first\fR,
581 are supported (e.g., numbers, \fBinsert\fR, \fBsel.first\fR,
507582 \fBend\fR, etc.).
508583 \fIindexProc\fR should return a Tcl completion code and set
509 \fIinterp->result\fR in the event of an error.
584 the interpreter result in the event of an error.
510585 .SS ICURSORPROC
511586 .PP
512 \fItypePtr->icursorProc\fR is invoked by Tk during
587 \fItypePtr\->icursorProc\fR is invoked by Tk during
513588 the \fBicursor\fR widget command to set the position of the
514589 insertion cursor in a textual item.
515590 It is only relevant for item types that support an insertion cursor;
516 \fItypePtr->icursorProc\fR may be specified as NULL for item types
591 \fItypePtr\->icursorProc\fR may be specified as NULL for item types
517592 that do not support an insertion cursor.
518593 The procedure must match the following prototype:
594 .PP
519595 .CS
520596 typedef void \fBTk_ItemCursorProc\fR(
521597 Tk_Canvas \fIcanvas\fR,
522598 Tk_Item *\fIitemPtr\fR,
523599 int \fIindex\fR);
524600 .CE
601 .PP
525602 \fIcanvas\fR and \fIitemPtr\fR have the usual meanings, and
526603 \fIindex\fR is an index into the item's text, as returned by a
527 previous call to \fItypePtr->insertProc\fR.
604 previous call to \fItypePtr\->insertProc\fR.
528605 The type manager should position the insertion cursor in the
529606 item just before the character given by \fIindex\fR.
530607 Whether or not to actually display the insertion cursor is
531608 determined by other information provided by \fBTk_CanvasGetTextInfo\fR.
532609 .SS SELECTIONPROC
533610 .PP
534 \fItypePtr->selectionProc\fR is invoked by Tk during selection
535 retrievals; it must return part or all of the selected text in
611 \fItypePtr\->selectionProc\fR is invoked by Tk during selection
612 retrievals; it must return part or all of the selected text in
536613 the item (if any).
537614 It is only relevant for item types that support text;
538 \fItypePtr->selectionProc\fR may be specified as NULL for non-textual
615 \fItypePtr\->selectionProc\fR may be specified as NULL for non-textual
539616 item types.
540617 The procedure must match the following prototype:
618 .PP
541619 .CS
542620 typedef int \fBTk_ItemSelectionProc\fR(
543621 Tk_Canvas \fIcanvas\fR,
546624 char *\fIbuffer\fR,
547625 int \fImaxBytes\fR);
548626 .CE
627 .PP
549628 \fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
550629 \fIoffset\fR is an offset in bytes into the selection where 0 refers
551 to the first byte of the selection; it identifies
630 to the first byte of the selection; it identifies
552631 the first character that is to be returned in this call.
553632 \fIbuffer\fR points to an area of memory in which to store the
554633 requested bytes, and \fImaxBytes\fR specifies the maximum number
555634 of bytes to return.
556635 \fIselectionProc\fR should extract up to \fImaxBytes\fR characters
557 from the selection and copy them to \fImaxBytes\fR; it should
636 from the selection and copy them to \fImaxBytes\fR; it should
558637 return a count of the number of bytes actually copied, which may
559638 be less than \fImaxBytes\fR if there are not \fIoffset+maxBytes\fR bytes
560639 in the selection.
561640 .SS INSERTPROC
562641 .PP
563 \fItypePtr->insertProc\fR is invoked by Tk during
564 the \fBinsert\fR widget command to insert new text into a
642 \fItypePtr\->insertProc\fR is invoked by Tk during
643 the \fBinsert\fR widget command to insert new text or coordinates into a
565644 canvas item.
566 It is only relevant for item types that support text;
567 \fItypePtr->insertProc\fR may be specified as NULL for non-textual
645 It is only relevant for item types that support the \fBinsert\fR method;
646 \fItypePtr\->insertProc\fR may be specified as NULL for other
568647 item types.
569648 The procedure must match the following prototype:
649 .PP
570650 .CS
571651 typedef void \fBTk_ItemInsertProc\fR(
572652 Tk_Canvas \fIcanvas\fR,
574654 int \fIindex\fR,
575655 char *\fIstring\fR);
576656 .CE
657 .PP
577658 \fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
578659 \fIindex\fR is an index into the item's text, as returned by a
579 previous call to \fItypePtr->insertProc\fR, and \fIstring\fR
660 previous call to \fItypePtr\->insertProc\fR, and \fIstring\fR
580661 contains new text to insert just before the character given
581662 by \fIindex\fR.
663 Note that if \fBTK_CONFIG_OBJS\fR is set in the
664 \fItypePtr\->alwaysRedraw\fR field, the \fIstring\fR parameter will
665 actually contain a Tcl_Obj reference to the string to insert.
666 If the item supports modification of the coordinates list by this
667 .PP
582668 The type manager should insert the text and recompute the bounding
583669 box in the item's header.
584670 .SS DCHARSPROC
585671 .PP
586 \fItypePtr->dCharsProc\fR is invoked by Tk during the \fBdchars\fR
587 widget command to delete a range of text from a canvas item.
672 \fItypePtr\->dCharsProc\fR is invoked by Tk during the \fBdchars\fR
673 widget command to delete a range of text from a canvas item or a range of
674 coordinates from a pathed item.
588675 It is only relevant for item types that support text;
589 \fItypePtr->dCharsProc\fR may be specified as NULL for non-textual
590 item types.
591 The procedure must match the following prototype:
676 \fItypePtr\->dCharsProc\fR may be specified as NULL for non-textual
677 item types that do not want to support coordinate deletion.
678 The procedure must match the following prototype:
679 .PP
592680 .CS
593681 typedef void \fBTk_ItemDCharsProc\fR(
594682 Tk_Canvas \fIcanvas\fR,
596684 int \fIfirst\fR,
597685 int \fIlast\fR);
598686 .CE
687 .PP
599688 \fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
600689 \fIfirst\fR and \fIlast\fR give the indices of the first and last bytes
601 to be deleted, as returned by previous calls to \fItypePtr->indexProc\fR.
690 to be deleted, as returned by previous calls to \fItypePtr\->indexProc\fR.
602691 The type manager should delete the specified characters and update
603692 the bounding box in the item's header.
604693 .SH "SEE ALSO"
88 '\" Department of Computer Science,
99 '\" Australian National University.
1010 '\"
11 '\" RCS: @(#) $Id: CrtPhImgFmt.3,v 1.11 2008/06/30 22:57:01 dkf Exp $
11 '\" RCS: @(#) $Id: CrtPhImgFmt.3,v 1.12 2008/11/09 23:16:56 nijtmans Exp $
1212 '\"
1313 .so man.macros
1414 .TH Tk_CreatePhotoImageFormat 3 8.5 Tk "Tk Library Procedures"
2121 .sp
2222 \fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR)
2323 .SH ARGUMENTS
24 .AS Tk_PhotoImageFormat *formatPtr
25 .AP Tk_PhotoImageFormat *formatPtr in
24 .AS "const Tk_PhotoImageFormat" *formatPtr
25 .AP "const Tk_PhotoImageFormat" *formatPtr in
2626 Structure that defines the new file format.
2727 .BE
2828 .SH DESCRIPTION
4646 Tk_PhotoImageFormat structure contains the following fields:
4747 .CS
4848 typedef struct Tk_PhotoImageFormat {
49 char *\fIname\fR;
49 const char *\fIname\fR;
5050 Tk_ImageFileMatchProc *\fIfileMatchProc\fR;
5151 Tk_ImageStringMatchProc *\fIstringMatchProc\fR;
5252 Tk_ImageFileReadProc *\fIfileReadProc\fR;
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: GetBitmap.3,v 1.15 2008/06/30 22:57:01 dkf Exp $
7 '\" RCS: @(#) $Id: GetBitmap.3,v 1.16 2008/11/05 22:58:30 nijtmans Exp $
88 '\"
99 .so man.macros
1010 .TH Tk_AllocBitmapFromObj 3 8.1 Tk "Tk Library Procedures"
8282 .TP 20
8383 \fB@\fIfileName\fR
8484 \fIFileName\fR must be the name of a file containing a bitmap
85 description in the standard X11 or X10 format.
85 description in the standard X11 format.
8686 .TP 20
8787 \fIname\fR
8888 \fIName\fR must be the name of a bitmap defined previously with
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: GetCursor.3,v 1.14 2008/06/30 22:57:01 dkf Exp $
7 '\" RCS: @(#) $Id: GetCursor.3,v 1.15 2008/11/05 22:58:29 nijtmans Exp $
88 '\"
99 .so man.macros
1010 .TH Tk_AllocCursorFromObj 3 8.1 Tk "Tk Library Procedures"
118118 \fB@\fIsourceName\0maskName\0fgColor\0bgColor\fR
119119 In this form, \fIsourceName\fR and \fImaskName\fR are the names of
120120 files describing cursors for the cursor's source bits and mask.
121 Each file must be in standard X11 or X10 cursor format.
121 Each file must be in standard X11 cursor format.
122122 \fIFgColor\fR and \fIbgColor\fR
123123 indicate the colors to use for the
124124 cursor, in any of the forms acceptable to \fBTk_GetColor\fR. This
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: Tk_Main.3,v 1.7 2008/06/30 22:57:02 dkf Exp $
7 '\" RCS: @(#) $Id: Tk_Main.3,v 1.8 2008/12/15 16:17:18 dgp Exp $
88 '\"
99 .so man.macros
1010 .TH Tk_Main 3 4.0 Tk "Tk Library Procedures"
5656 \fIAppInitProc\fR is almost always a pointer to \fBTcl_AppInit\fR;
5757 for more details on this procedure, see the documentation
5858 for \fBTcl_AppInit\fR.
59 .PP
60 \fBTk_Main\fR functions much the same as \fBTcl_Main\fR. In particular,
61 \fBTk_Main\fR supports both an interactive mode and a startup script
62 mode, with the file name and encoding of a startup script under the
63 control of the \fBTcl_SetStartupScript\fR and \fBTcl_GetStartupScript\fR
64 routines.
5965 .SH KEYWORDS
6066 application-specific initialization, command-line arguments, main program
0 '\"
1 '\" Copyright (c) 1993-1998 Lucent Technologies, Inc.
2 '\" Copyright (c) 2008 Jos Decoster
3 '\"
4 '\" Permission to use, copy, modify, and distribute this software and its
5 '\" documentation for any purpose and without fee is hereby granted, provided
6 '\" that the above copyright notice appear in all copies and that both that
7 '\" the copyright notice and warranty disclaimer appear in supporting
8 '\" documentation, and that the names of Lucent Technologies any of their
9 '\" entities not be used in advertising or publicity pertaining to
10 '\" distribution of the software without specific, written prior permission.
11 '\"
12 '\" Lucent Technologies disclaims all warranties with regard to this software,
13 '\" including all implied warranties of merchantability and fitness. In no
14 '\" event shall Lucent Technologies be liable for any special, indirect or
15 '\" consequential damages or any damages whatsoever resulting from loss of
16 '\" use, data or profits, whether in an action of contract, negligence or
17 '\" other tortuous action, arising out of or in connection with the use or
18 '\" performance of this software.
19 '\"
20 '\" BLT::busy command created by George Howlett.
21 '\"
22 '\" See the file "license.terms" for information on usage and redistribution
23 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
24 '\"
25 '\" RCS: @(#) $Id: busy.n,v 1.2 2008/11/24 09:56:44 dkf Exp $
26 '\"
27 .so man.macros
28 .TH busy n "" Tk "Tk Built-In Commands"
29 '\" Note: do not modify the .SH NAME line immediately below!
30 .SH NAME
31 busy \- confine pointer and keyboard events to a window sub-tree
32 .SH SYNOPSIS
33 \fBtk busy\fR \fIwindow \fR?\fIoptions\fR?
34 .sp
35 \fBtk busy hold\fR \fIwindow \fR?\fIoptions\fR?
36 .sp
37 \fBtk busy configure \fIwindow\fR ?\fIoption value\fR?...
38 .sp
39 \fBtk busy forget\fR \fIwindow \fR?\fIwindow \fR?...
40 .sp
41 \fBtk busy current\fR ?\fIpattern\fR?
42 .sp
43 \fBtk busy status \fIwindow\fR
44 .BE
45 .SH DESCRIPTION
46 .PP
47 The \fBtk busy\fR command provides a simple means to block keyboard, button,
48 and pointer events from Tk widgets, while overriding the widget's cursor with
49 a configurable busy cursor.
50 .SH INTRODUCTION
51 .PP
52 There are many times in applications where you want to temporarily restrict
53 what actions the user can take. For example, an application could have a
54 .QW Run
55 button that when pressed causes some processing to occur. But while the
56 application is busy processing, you probably don't want the the user to be
57 able to click the
58 .QW Run
59 button again. You may also want restrict the user from other tasks such as
60 clicking a
61 .QW Print
62 button.
63 .PP
64 The \fBtk busy\fR command lets you make Tk widgets busy. This means that user
65 interactions such as button clicks, moving the mouse, typing at the keyboard,
66 etc.\0are ignored by the widget. You can set a special cursor (like a watch)
67 that overrides the widget's normal cursor, providing feedback that the
68 application (widget) is temporarily busy.
69 .PP
70 When a widget is made busy, the widget and all of its descendents will ignore
71 events. It's easy to make an entire panel of widgets busy. You can simply make
72 the toplevel widget (such as
73 .QW . )
74 busy. This is easier and far much more efficient than recursively traversing
75 the widget hierarchy, disabling each widget and re-configuring its cursor.
76 .PP
77 Often, the \fBtk busy\fR command can be used instead of Tk's \fBgrab\fR
78 command. Unlike \fBgrab\fR which restricts all user interactions to one
79 widget, with the \fBtk busy\fR command you can have more than one widget
80 active (for example, a
81 .QW Cancel
82 dialog and a
83 .QW Help
84 button).
85 .SS EXAMPLE
86 .PP
87 You can make several widgets busy by simply making its ancestor widget busy
88 using the \fBhold\fR operation.
89 .PP
90 .CS
91 frame .top
92 button .top.button; canvas .top.canvas
93 pack .top.button .top.canvas
94 pack .top
95 # . . .
96 \fBtk busy\fR hold .top
97 update
98 .CE
99 .PP
100 All the widgets within \fB.top\fR (including \fB.top\fR) are now busy. Using
101 \fBupdate\fR insures that \fBtk busy\fR command will take effect before any
102 other user events can occur.
103 .PP
104 When the application is no longer busy processing, you can allow user
105 interactions again and free any resources it allocated by the \fBforget\fR
106 operation.
107 .PP
108 .CS
109 \fBtk busy\fR forget .top
110 .CE
111 .PP
112 The busy window has a configurable cursor. You can change the busy cursor
113 using the \fBconfigure\fR operation.
114 .PP
115 .CS
116 \fBtk busy\fR configure .top \-cursor "watch"
117 .CE
118 .PP
119 Destroying the widget will also clean up any resources allocated by the \fBtk
120 busy\fR command.
121 .PP
122 .SH OPERATIONS
123 .PP
124 The following operations are available for the \fBtk busy\fR command:
125 .TP
126 \fBtk busy \fIwindow\fR ?\fIoption value\fR?...
127 .
128 Shortcut for \fBtk busy hold\fR command.
129 .TP
130 \fBtk busy hold \fIwindow\fR ?\fIoption value\fR?...
131 .
132 Makes the specified \fIwindow\fR (and its descendants in the Tk window
133 hierarchy) appear busy. \fIWindow\fR must be a valid path name of a Tk widget.
134 A transparent window is put in front of the specified window. This transparent
135 window is mapped the next time idle tasks are processed, and the specified
136 window and its descendants will be blocked from user interactions. Normally
137 \fBupdate\fR should be called immediately afterward to insure that the hold
138 operation is in effect before the application starts its processing. The
139 following configuration options are valid:
140 .RS
141 .TP
142 \fB\-cursor \fIcursorName\fR
143 .
144 Specifies the cursor to be displayed when the widget is made busy.
145 \fICursorName\fR can be in any form accepted by \fBTk_GetCursor\fR. The
146 default cursor is \fBwait\fR on Windows and \fBwatch\fR on other platforms.
147 .RE
148 .TP
149 \fBtk busy cget \fIwindow\fR \fIoption\fR
150 .
151 Queries the \fBtk busy\fR command configuration options for \fIwindow\fR.
152 \fIWindow\fR must be the path name of a widget previously made busy by the
153 \fBhold\fR operation. The command returns the present value of the specified
154 \fIoption\fR. \fIOption\fR may have any of the values accepted by the
155 \fBhold\fR operation.
156 .TP
157 \fBtk busy configure \fIwindow\fR ?\fIoption value\fR?...
158 .
159 Queries or modifies the \fBtk busy\fR command configuration options for
160 \fIwindow\fR. \fIWindow\fR must be the path name of a widget previously made
161 busy by the \fBhold\fR operation. If no options are specified, a list
162 describing all of the available options for \fIwindow\fR (see
163 \fBTk_ConfigureInfo\fR for information on the format of this list) is
164 returned. If \fIoption\fR is specified with no \fIvalue\fR, then the command
165 returns a list describing the one named option (this list will be identical to
166 the corresponding sublist of the value returned if no \fIoption\fR is
167 specified). If one or more \fIoption\-value\fR pairs are specified, then the
168 command modifies the given widget option(s) to have the given value(s); in
169 this case the command returns the empty string. \fIOption\fR may have any of
170 the values accepted by the \fBhold\fR operation.
171 .RS
172 .PP
173 Please note that the option database is referenced through \fIwindow\fR. For
174 example, if the widget \fB.frame\fR is to be made busy, the busy cursor can be
175 specified for it by either \fBoption\fR command:
176 .PP
177 .CS
178 option add *frame.busyCursor gumby
179 option add *Frame.BusyCursor gumby
180 .CE
181 .RE
182 .TP
183 \fBtk busy forget \fIwindow\fR ?\fIwindow\fR?...
184 .
185 Releases resources allocated by the \fBtk busy\fR command for \fIwindow\fR,
186 including the transparent window. User events will again be received by
187 \fIwindow\fR. Resources are also released when \fIwindow\fR is destroyed.
188 \fIWindow\fR must be the name of a widget specified in the \fBhold\fR
189 operation, otherwise an error is reported.
190 .TP
191 \fBtk busy current \fR?\fIpattern\fR?
192 .
193 Returns the pathnames of all widgets that are currently busy. If a
194 \fIpattern\fR is given, only the path names of busy widgets matching
195 \fIpattern\fR are returned.
196 .TP
197 \fBtk busy status \fIwindow\fR
198 .
199 Returns the status of a widget \fIwindow\fR. If \fIwindow\fR presently can not
200 receive user interactions, \fB1\fR is returned, otherwise \fB0\fR.
201 .SH "EVENT HANDLING"
202 .SS BINDINGS
203 .PP
204 The event blocking feature is implemented by creating and mapping a
205 transparent window that completely covers the widget. When the busy window is
206 mapped, it invisibly shields the widget and its hierarchy from all events that
207 may be sent. Like Tk widgets, busy windows have widget names in the Tk window
208 hierarchy. This means that you can use the \fBbind\fR command, to handle
209 events in the busy window.
210 .PP
211 .CS
212 \fBtk busy\fR hold .frame.canvas
213 bind .frame.canvas_Busy <Enter> { ... }
214 .CE
215 .PP
216 Normally the busy window is a sibling of the widget. The name of the busy
217 window is
218 .QW \fIwidget\fB_Busy\fR
219 where \fIwidget\fR is the name of the widget to be made busy. In the previous
220 example, the pathname of the busy window is
221 .QW \fB.frame.canvas_Busy\fR .
222 The exception is when the widget is a toplevel widget (such as
223 .QW . )
224 where the busy window can't be made a sibling. The busy window is then a child
225 of the widget named
226 .QW \fIwidget\fB._Busy\fR
227 where \fIwidget\fR is the name of the toplevel widget. In the following
228 example, the pathname of the busy window is
229 .QW \fB._Busy\fR .
230 .PP
231 .CS
232 \fBtk busy\fR hold .
233 bind ._Busy <Enter> { ... }
234 .CE
235 .SS "ENTER/LEAVE EVENTS"
236 .PP
237 Mapping and unmapping busy windows generates Enter/Leave events for all
238 widgets they cover. Please note this if you are tracking Enter/Leave events in
239 widgets.
240 .SS "KEYBOARD EVENTS"
241 .PP
242 When a widget is made busy, the widget is prevented from gaining the keyboard
243 focus by the busy window. But if the widget already had focus, it still may
244 received keyboard events. To prevent this, you must move focus to another
245 window.
246 .PP
247 .CS
248 \fBtk busy\fR hold .frame
249 label .dummy
250 focus .dummy
251 update
252 .CE
253 .PP
254 The above example moves the focus from .frame immediately after invoking the
255 \fBhold\fR so that no keyboard events will be sent to \fB.frame\fR or any of
256 its descendants.
257 .SH PORTABILITY
258 .PP
259 Note that the \fBtk busy\fR command does not currently have any effect on OSX
260 when Tk is built using Aqua support.
261 .SH "SEE ALSO"
262 grab(n)
263 .SH KEYWORDS
264 busy, keyboard events, pointer events, window
265 '\" Local Variables:
266 '\" mode: nroff
267 '\" End:
55 '\" See the file "license.terms" for information on usage and redistribution
66 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
77 '\"
8 '\" RCS: @(#) $Id: canvas.n,v 1.38 2008/10/02 19:13:35 mistachkin Exp $
8 '\" RCS: @(#) $Id: canvas.n,v 1.40 2008/11/22 20:16:43 dkf Exp $
99 '\"
1010 .so man.macros
1111 .TH canvas n 8.3 Tk "Tk Built-In Commands"
567567 For each item given by \fItagOrId\fR, delete the characters, or coordinates,
568568 in the range given by \fIfirst\fR and \fIlast\fR, inclusive.
569569 If some of the items given by \fItagOrId\fR do not support
570 indexing operations then they ignore dchars.
570 indexing operations then they ignore this operation.
571571 Text items interpret \fIfirst\fR and \fIlast\fR as indices to a character,
572 line and polygon items interpret them indices to a coordinate (an x,y pair).
572 line and polygon items interpret them as indices to a coordinate (an x,y pair).
573573 Indices are described in \fBINDICES\fR above.
574574 If \fIlast\fR is omitted, it defaults to \fIfirst\fR.
575575 This command returns an empty string.
649649 command \fBfocus\fR, below), but the cursor position may
650650 be set even when the item does not have the focus.
651651 This command returns an empty string.
652 .TP
653 \fIpathName \fBimove \fItagOrId index x y\fR
654 .VS 8.6
655 This command causes the \fIindex\fR'th coordinate of each of the items
656 indicated by \fItagOrId\fR to be relocated to the location (\fIx\fR,\fIy\fR).
657 Each item interprets \fIindex\fR independently according to the rules
658 described in \fBINDICES\fR above. Out of the standard set of items, only line
659 and polygon items may have their coordinates relocated this way.
660 .VE 8.6
652661 .TP
653662 \fIpathName \fBindex \fItagOrId index\fR
654663 .
917926 \fBraise\fR and \fBlower\fR widget commands for canvases.
918927 This command returns an empty string.
919928 .TP
929 \fIpathName \fBrchars \fItagOrId first last string\fR
930 .VS 8.6
931 This command causes the text or coordinates between \fIfirst\fR and \fIlast\fR
932 for each of the items indicated by \fItagOrId\fR to be replaced by
933 \fIstring\fR. Each item interprets \fIfirst\fR and \fIlast\fR independently
934 according to the rules described in \fBINDICES\fR above. Out of the standard
935 set of items, text items support this operation by altering their text as
936 directed, and line and polygon items support this operation by altering their
937 coordinate list (in which case \fIstring\fR should be a list of coordinates to
938 use as a replacement). The other items ignore this operation.
939 .VE 8.6
940 .TP
920941 \fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fR
921942 .
922943 Rescale all of the items given by \fItagOrId\fR in canvas coordinate
17971818 text will be at the positioning point.
17981819 This option defaults to \fBcenter\fR.
17991820 .TP
1821 \fB\-angle \fIrotationDegrees\fR
1822 .VS 8.6
1823 \fIRotationDegrees\fR tells how many degrees to rotate the text anticlockwise
1824 about the positioning point for the text; it may have any floating-point value
1825 from 0.0 to 360.0. For example, if \fIrotationDegrees\fR is \fB90\fR, then the
1826 text will be drawn vertically from bottom to top.
1827 This option defaults to \fB0.0\fR.
1828 .VE 8.6
1829 .TP
18001830 \fB\-font \fIfontName\fR
18011831 Specifies the font to use for the text item.
18021832 \fIFontName\fR may be any string acceptable to \fBTk_GetFont\fR.
0 '\"
1 '\" Copyright (c) 2008 Daniel A. Steffen <das@users.sourceforge.net>
2 '\"
3 '\" See the file "license.terms" for information on usage and redistribution
4 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 '\"
6 '\" RCS: @(#) $Id: fontchooser.n,v 1.1 2008/12/10 05:02:40 das Exp $
7 '\"
8 .so man.macros
9 .TH fontchooser n "" Tk "Tk Built-In Commands"
10 .BS
11 '\" Note: do not modify the .SH NAME line immediately below!
12 .SH NAME
13 fontchooser \- control font selection dialog
14 .SH SYNOPSIS
15 \fBtk fontchooser\fR \fBconfigure\fR ?\fI\-option value \-option value ...\fR?
16 .sp
17 \fBtk fontchooser\fR \fBshow\fR
18 .sp
19 \fBtk fontchooser\fR \fBhide\fR
20 .BE
21 .SH DESCRIPTION
22 .PP
23 The \fBtk fontchooser\fR command controls the Tk font selection dialog. It uses
24 the native platform font selection dialog where available, or a dialog
25 implemented in Tcl otherwise.
26 .PP
27 Unlike most of the other Tk dialog commands, \fBtk fontchooser\fR does not
28 return an immediate result, as on some platforms (Mac OS X) the standard font
29 dialog is modeless while on others (Windows) it is modal. To accommodate this
30 difference, all user interaction with the dialog will be communicated to the
31 caller via callbacks or virtual events.
32 .PP
33 The \fBtk fontchooser\fR command can have one of the following forms:
34 .TP
35 \fBtk fontchooser\fR \fBconfigure \fR?\fI\-option value \-option value ...\fR?
36 .
37 Set or query one or more of the configurations options below (analogous to Tk
38 widget configuration).
39 .TP
40 \fBtk fontchooser\fR \fBshow\fR
41 .
42 Show the font selection dialog. Depending on the platform, may return
43 immediately or only once the dialog has been withdrawn.
44 .TP
45 \fBtk fontchooser\fR \fBhide\fR
46 .
47 Hide the font selection dialog if it is visible and cause any pending
48 \fBtk fontchooser\fR \fBshow\fR command to return.
49 .PP
50 .SH "CONFIGURATION OPTIONS"
51 .TP
52 \fB\-parent\fR
53 Specifies/returns the logical parent window of the font selection dialog
54 (similar to the \fB\-parent\fR option to other dialogs). The font selection
55 dialog is hidden if it is visible when the parent window is destroyed.
56 .TP
57 \fB\-title\fR
58 Specifies/returns the title of the dialog. Has no effect on platforms where the
59 font selection dialog does not support titles.
60 .TP
61 \fB\-font\fR
62 Specifies/returns the font that is currently selected in the dialog if it is
63 visible, or that will be initially selected when the dialog is shown (if
64 supported by the platform). Can be set to the empty string to indicate that no
65 font should be selected. Fonts can be specified in any form given by the "FONT
66 DESCRIPTION" section in the \fBfont\fR manual page.
67 .TP
68 \fB\-command\fR
69 Specifies/returns the command prefix to be called when a font selection has
70 been made by the user. The command prefix is evaluated at the global level
71 after having the specification of the selected font appended. On platforms
72 where the font selection dialog offers the user control of further font
73 attributes (such as color), additional key/value pairs may be appended before
74 evaluation. Can be set to the empty string to indicate that no callback should
75 be invoked. Fonts are specified by a list of form [3] of the "FONT DESCRIPTION"
76 section in the \fBfont\fR manual page (i.e. a list of the form
77 \fI{family size style ?style ...?}\fR).
78 .TP
79 \fB\-visible\fR
80 Read-only option that returns a boolean indicating whether the font selection
81 dialog is currently visible. Attempting to set this option results in an error.
82
83 .PP
84 .SH "VIRTUAL EVENTS"
85 .TP
86 \fB<<TkFontchooserVisibility>>\fR
87 Sent to the dialog parent whenever the visibility of the font selection dialog
88 changes, both as a result of user action (e.g. disposing of the dialog via
89 OK/Cancel button or close box) and of the \fBtk fontchooser\fR
90 \fBshow\fR/\fBhide\fR commands being called. Binding scripts can determine the
91 current visibility of the dialog by querying the \fB\-visible\fR configuration
92 option.
93 .TP
94 \fB<<TkFontchooserFontChanged>>\fR
95 Sent to the dialog parent whenever the font selection dialog is visible and the
96 selected font changes, both as a result of user action and of the \fB\-font\fR
97 configuration option being set. Binding scripts can determine the currently
98 selected font by querying the \fB\-font\fR configuration option.
99 .PP
100 .SH NOTES
101 .PP
102 Callers should not expect a result from \fBtk fontchooser\fR \fBshow\fR and may
103 not assume that the dialog has been withdrawn or closed when the command
104 returns. All user interaction with the dialog is communicated to the caller via
105 the \fB\-command\fR callback and the \fB<<TkFontchooser*>>\fR virtual events.
106 It is implementation dependent which exact user actions result in the callback
107 being called resp. the virtual events being sent. Where an Apply or OK button
108 is present in the dialog, that button will trigger the \fB\-command\fR callback
109 and \fB<<TkFontchooserFontChanged>>\fR virtual event. On some implementations
110 other user actions may also have that effect; on Mac OS X for instance, the
111 standard font selection dialog immediately reflects all user choices to the
112 caller.
113 .PP
114 In the presence of multiple widgets intended to be influenced by the font
115 selection dialog, care needs to be taken to correctly handle focus changes: the
116 font selected in the dialog should always match the current font of the widget
117 with the focus, and the \fB\-command\fR callback should only act on the widget
118 with the focus. The recommended practice is to set font dialog \fB\-font\fR and
119 \fB\-command\fR configuration options in per\-widget \fB<FocusIn>\fR handlers
120 (and if necessary to unset them \- i.e. set to the empty string \- in
121 corresponding \fB<FocusOut>\fR handlers). This is particularly important for
122 implementors of library code using the font selection dialog, to avoid
123 conflicting with application code that may also want to use the dialog.
124 .PP
125 Because the font selection dialog is application-global, in the presence of
126 multiple interpreters calling \fBtk fontchooser\fR, only the \fB\-command\fR
127 callback set by the interpreter that most recently called \fBtk fontchooser\fR
128 \fBconfigure\fR or \fBtk fontchooser\fR \fBshow\fR will be invoked in response
129 to user action and only the \fB\-parent\fR set by that interpreter will receive
130 \fB<<TkFontchooser*>>\fR virtual events.
131 .PP
132 The font dialog implementation may only store (and return) \fBfont\fR
133 \fBactual\fR data as the value of the \fB\-font\fR configuration option. This
134 can be an issue when \fB\-font\fR is set to a named font, if that font is
135 subsequently changed, the font dialog \fB\-font\fR option needs to be set again
136 to ensure its selected font matches the new value of the named font.
137 .PP
138 .SH EXAMPLE
139 .PP
140 .CS
141 proc fontchooserDemo {} {
142 wm title . "Font Chooser Demo"
143 \fBtk fontchooser\fR \fBconfigure\fR \-parent .
144 button .b \-command fontchooserToggle \-takefocus 0
145 fontchooserVisibility .b
146 bind . \fB<<TkFontchooserVisibility>>\fR \\
147 [list fontchooserVisibility .b]
148 foreach w {.t1 .t2} {
149 text $w \-width 20 \-height 4 \-borderwidth 1 \-relief solid
150 bind $w <FocusIn> [list fontchooserFocus $w]
151 $w insert end "Text Widget $w"
152 }
153 .t1 configure \-font {Courier 14}
154 .t2 configure \-font {Times 16}
155 pack .b .t1 .t2; focus .t1
156 }
157 proc fontchooserToggle {} {
158 \fBtk fontchooser\fR [expr {
159 [\fBtk fontchooser\fR \fBconfigure\fR \-visible] ?
160 "\fBhide\fR" : "\fBshow\fR"}]
161 }
162 proc fontchooserVisibility {w} {
163 $w configure \-text [expr {
164 [\fBtk fontchooser\fR \fBconfigure\fR \-visible] ?
165 "Hide Font Dialog" : "Show Font Dialog"}]
166 }
167 proc fontchooserFocus {w} {
168 \fBtk fontchooser\fR \fBconfigure\fR \-font [$w cget \-font] \\
169 \-command [list fontchooserFontSelection $w]
170 }
171 proc fontchooserFontSelection {w font args} {
172 $w configure \-font [font actual $font]
173 }
174 fontchooserDemo
175 .CE
176 .SH "SEE ALSO"
177 font(n), tk(n)
178 .SH KEYWORDS
179 dialog, font, font selection, font chooser, font panel
180 '\" Local Variables:
181 '\" mode: nroff
182 '\" End:
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: grab.n,v 1.10 2008/09/23 13:36:40 dkf Exp $
7 '\" RCS: @(#) $Id: grab.n,v 1.11 2008/10/18 14:22:21 dkf Exp $
88 '\"
99 .so man.macros
1010 .TH grab n "" Tk "Tk Built-In Commands"
132132 pack [button .b3 \-text "Click me! #3" \-command {destroy .b3}]
133133 \fBgrab\fR .b2
134134 .CE
135 .SH "SEE ALSO"
136 busy(n)
135137 .SH KEYWORDS
136138 grab, keyboard events, pointer events, window
137139 '\" Local Variables:
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: selection.n,v 1.14 2008/09/23 13:36:54 dkf Exp $
7 '\" RCS: @(#) $Id: selection.n,v 1.15 2008/12/17 22:36:46 dkf Exp $
88 '\"
99 .so man.macros
1010 .TH selection n 8.1 Tk "Tk Built-In Commands"
128128 application owns the selection. \fISelection\fR defaults to PRIMARY and
129129 \fIwindow\fR defaults to
130130 .QW . .
131 .RS
131132 .PP
132133 The second form of \fBselection own\fR causes \fIwindow\fR to become
133134 the new owner of \fIselection\fR on \fIwindow\fR's display, returning
136137 If \fIcommand\fR is specified, it is a Tcl script to execute when
137138 some other window claims ownership of the selection away from
138139 \fIwindow\fR. \fISelection\fR defaults to PRIMARY.
140 .RE
139141 .SH EXAMPLES
140142 .PP
141143 On X11 platforms, one of the standard selections available is the
154156 .CE
155157 .PP
156158 To claim the selection, you must first set up a handler to supply the
157 data for the selection. Then you have to claim the selection...
159 data for the selection. Then you have to claim the selection...
158160 .CS
159161 # Set up the data handler ready for incoming requests
160162 set foo "This is a string with some data in it... blah blah"
161163 \fBselection handle\fR \-selection SECONDARY . getData
162164 proc getData {offset maxChars} {
163165 puts "Retrieving selection starting at $offset"
164 return [string range $::foo $offset [expr {$offset+$maxChars}]]
166 return [string range $::foo $offset [expr {$offset+$maxChars-1}]]
165167 }
166168
167169 # Now we grab the selection itself
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: text.n,v 1.57 2008/09/23 13:36:55 dkf Exp $
7 '\" RCS: @(#) $Id: text.n,v 1.58 2008/12/06 10:48:29 dkf Exp $
88 '\"
99 .so man.macros
1010 .TH text n 8.5 Tk "Tk Built-In Commands"
5050 Specifies the colour to use for the selection (the \fBsel\fR tag) when the
5151 window does not have the input focus. If empty, \fB{}\fR, then no selection is
5252 shown when the window does not have the focus.
53 .OP \-insertunfocussed insertUnfocussed InsertUnfocussed
54 .VS 8.6
55 Specifies how to display the insertion cursor when the widget does not have
56 the focus. Must be \fBnone\fR (the default) which means to not display the
57 cursor, \fBhollow\fR which means to display a hollow box, or \fBsolid\fR which
58 means to display a solid box. Note that \fBhollow\fR and \fBsolid\fR will
59 appear very similar when the \fB\-blockcursor\fR option is false.
60 .VE 8.6
5361 .OP \-maxundo maxUndo MaxUndo
5462 Specifies the maximum number of compound undo actions on the undo stack. A
5563 zero or a negative value imply an unlimited undo stack.
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: tk.n,v 1.19 2008/09/23 13:36:55 dkf Exp $
7 '\" RCS: @(#) $Id: tk.n,v 1.21 2008/12/10 05:02:40 das Exp $
88 '\"
99 .so man.macros
1010 .TH tk n 8.4 Tk "Tk Built-In Commands"
4646 this command will reenable them and recreate the \fBsend\fR
4747 command.
4848 .TP
49 \fBtk busy \fIsubcommand\fR ...
50 .
51 This command controls the marking of window hierarchies as
52 .QW busy ,
53 rendering them non-interactive while some other operation is proceeding. For
54 more details see the \fBbusy\fR manual page.
55 .TP
4956 \fBtk caret window \fR?\fB\-x \fIx\fR? ?\fB\-y \fIy\fR? ?\fB\-height \fIheight\fR?
5057 .
5158 Sets and queries the caret location for the display of the specified
5764 format. \fI\-x\fR and \fI\-y\fR represent window-relative coordinates, and
5865 \fI\-height\fR is the height of the current cursor location, or the height
5966 of the specified \fIwindow\fR if none is given.
60 .TP
61 \fBtk scaling \fR?\fB\-displayof \fIwindow\fR? ?\fInumber\fR?
62 .
63 Sets and queries the current scaling factor used by Tk to convert between
64 physical units (for example, points, inches, or millimeters) and pixels. The
65 \fInumber\fR argument is a floating point number that specifies the number of
66 pixels per point on \fIwindow\fR's display. If the \fIwindow\fR argument is
67 omitted, it defaults to the main window. If the \fInumber\fR argument is
68 omitted, the current value of the scaling factor is returned.
69 .RS
70 .PP
71 A
72 .QW point
73 is a unit of measurement equal to 1/72 inch. A scaling factor
74 of 1.0 corresponds to 1 pixel per point, which is equivalent to a standard
75 72 dpi monitor. A scaling factor of 1.25 would mean 1.25 pixels per point,
76 which is the setting for a 90 dpi monitor; setting the scaling factor to
77 1.25 on a 72 dpi monitor would cause everything in the application to be
78 displayed 1.25 times as large as normal. The initial value for the scaling
79 factor is set when the application starts, based on properties of the
80 installed monitor, but it can be changed at any time. Measurements made
81 after the scaling factor is changed will use the new scaling factor, but it
82 is undefined whether existing widgets will resize themselves dynamically to
83 accommodate the new scaling factor.
84 .RE
8567 .TP
8668 \fBtk inactive \fR?\fB\-displayof \fIwindow\fR? ?\fBreset\fR?
8769 .
10183 error if tried.
10284 .RE
10385 .TP
86 \fBtk fontchooser \fIsubcommand\fR ...
87 Controls the Tk font selection dialog. For more details see the
88 \fBfontchooser\fR manual page.
89 .TP
90 \fBtk scaling \fR?\fB\-displayof \fIwindow\fR? ?\fInumber\fR?
91 .
92 Sets and queries the current scaling factor used by Tk to convert between
93 physical units (for example, points, inches, or millimeters) and pixels. The
94 \fInumber\fR argument is a floating point number that specifies the number of
95 pixels per point on \fIwindow\fR's display. If the \fIwindow\fR argument is
96 omitted, it defaults to the main window. If the \fInumber\fR argument is
97 omitted, the current value of the scaling factor is returned.
98 .RS
99 .PP
100 A
101 .QW point
102 is a unit of measurement equal to 1/72 inch. A scaling factor
103 of 1.0 corresponds to 1 pixel per point, which is equivalent to a standard
104 72 dpi monitor. A scaling factor of 1.25 would mean 1.25 pixels per point,
105 which is the setting for a 90 dpi monitor; setting the scaling factor to
106 1.25 on a 72 dpi monitor would cause everything in the application to be
107 displayed 1.25 times as large as normal. The initial value for the scaling
108 factor is set when the application starts, based on properties of the
109 installed monitor, but it can be changed at any time. Measurements made
110 after the scaling factor is changed will use the new scaling factor, but it
111 is undefined whether existing widgets will resize themselves dynamically to
112 accommodate the new scaling factor.
113 .RE
114 .TP
104115 \fBtk useinputmethods \fR?\fB\-displayof \fIwindow\fR? ?\fIboolean\fR?
105116 .
106117 Sets and queries the state of whether Tk should use XIM (X Input Methods)
117128 \fBx11\fR (X11-based), \fBwin32\fR (MS Windows),
118129 or \fBaqua\fR (Mac OS X Aqua).
119130 .SH "SEE ALSO"
120 send(n), winfo(n)
131 busy(n), fontchooser(n), send(n), winfo(n)
121132 .SH KEYWORDS
122133 application name, send
123134 '\" Local Variables:
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: ttk_button.n,v 1.14 2008/09/23 13:36:56 dkf Exp $
6 '\" RCS: @(#) $Id: ttk_button.n,v 1.15 2008/12/04 15:47:22 dkf Exp $
77 '\"
88 .so man.macros
99 .TH ttk::button n 8.5 Tk "Tk Themed Widget"
6363 .TP
6464 \fIpathName \fBinvoke\fR
6565 Invokes the command associated with the button.
66 .SH "STANDARD STYLES"
67 .PP
68 \fBTtk::button\fR widgets support the \fBToolbutton\fR style in all standard
69 themes, which is useful for creating widgets for toolbars.
6670 .SH "COMPATIBILITY OPTIONS"
6771 .OP \-state state State
6872 May be set to \fBnormal\fR or \fBdisabled\fR to control the
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: ttk_checkbutton.n,v 1.15 2008/09/23 13:36:56 dkf Exp $
6 '\" RCS: @(#) $Id: ttk_checkbutton.n,v 1.16 2008/12/04 15:47:22 dkf Exp $
77 '\"
88 .so man.macros
99 .TH ttk::checkbutton n 8.5 Tk "Tk Themed Widget"
6565 or
6666 .QW indeterminate
6767 selection.)
68 .SH "STANDARD STYLES"
69 .PP
70 \fBTtk::checkbutton\fR widgets support the \fBToolbutton\fR style in all
71 standard themes, which is useful for creating widgets for toolbars.
6872 .SH "SEE ALSO"
6973 ttk::widget(n), ttk::radiobutton(n), checkbutton(n)
7074 .SH "KEYWORDS"
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: ttk_combobox.n,v 1.18 2008/09/23 13:36:56 dkf Exp $
6 '\" RCS: @(#) $Id: ttk_combobox.n,v 1.19 2008/10/27 13:38:51 dkf Exp $
77 '\"
88 .so man.macros
99 .TH ttk::combobox n 8.5 Tk "Tk Themed Widget"
2929 If set, the widget selection is linked to the X selection.
3030 .OP \-justify justify Justify
3131 Specifies how the text is aligned within the widget.
32 One of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
32 Must be one of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
3333 .OP \-height height Height
3434 Specifies the height of the pop-down listbox, in rows.
3535 .OP \-postcommand postCommand PostCommand
5555 Specifies an integer value indicating the desired width of the entry window,
5656 in average-size characters of the widget's font.
5757 .SH "WIDGET COMMAND"
58 .TP
59 \fIpathName \fBcget\fR \fIoption\fR
60 Returns the current value of the specified \fIoption\fR.
61 See \fIttk::widget(n)\fR.
62 .TP
63 \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
64 Modify or query widget options.
65 See \fIttk::widget(n)\fR.
58 .PP
59 The following subcommands are possible for combobox widgets:
60 '\".TP
61 '\"\fIpathName \fBcget\fR \fIoption\fR
62 '\"Returns the current value of the specified \fIoption\fR.
63 '\"See \fIttk::widget(n)\fR.
64 '\".TP
65 '\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
66 '\"Modify or query widget options.
67 '\"See \fIttk::widget(n)\fR.
6668 .TP
6769 \fIpathName \fBcurrent\fR ?\fInewIndex\fR?
6870 If \fInewIndex\fR is supplied, sets the combobox value
7274 .TP
7375 \fIpathName \fBget\fR
7476 Returns the current value of the combobox.
75 .TP
76 \fIpathName \fBidentify \fIx y\fR
77 Returns the name of the element at position \fIx\fR, \fIy\fR.
78 See \fIttk::widget(n)\fR.
79 .TP
80 \fIpathName \fBinstate \fIstateSpec\fR ?\fIscript\fR?
81 Test the widget state.
82 See \fIttk::widget(n)\fR.
77 '\".TP
78 '\"\fIpathName \fBidentify \fIx y\fR
79 '\"Returns the name of the element at position \fIx\fR, \fIy\fR.
80 '\"See \fIttk::widget(n)\fR.
81 '\".TP
82 '\"\fIpathName \fBinstate \fIstateSpec\fR ?\fIscript\fR?
83 '\"Test the widget state.
84 '\"See \fIttk::widget(n)\fR.
8385 .TP
8486 \fIpathName \fBset\fR \fIvalue\fR
8587 Sets the value of the combobox to \fIvalue\fR.
86 .TP
87 \fIpathName \fBstate\fR ?\fIstateSpec\fR?
88 Modify or query the widget state.
89 See \fIttk::widget(n)\fR.
88 '\".TP
89 '\"\fIpathName \fBstate\fR ?\fIstateSpec\fR?
90 '\"Modify or query the widget state.
91 '\"See \fIttk::widget(n)\fR.
9092 .PP
91 The combobox widget also supports the following \fIttk::entry\fR
92 widget commands (see \fIttk::entry(n)\fR for details):
93 The combobox widget also supports the following \fBttk::entry\fR
94 widget subcommands (see \fIttk::entry(n)\fR for details):
9395 .DS
9496 .ta 5.5c 11c
9597 \fBbbox\fR \fBdelete\fR \fBicursor\fR
9698 \fBindex\fR \fBinsert\fR \fBselection\fR
9799 \fBxview\fR
100 .DE
101 The combobox widget also supports the following generic \fBttk::widget\fR
102 widget subcommands (see \fIttk::widget(n)\fR for details):
103 .DS
104 .ta 5.5c 11c
105 \fBcget\fR \fBconfigure\fR \fBidentify\fR
106 \fBinstate\fR \fBstate\fR
98107 .DE
99108 .SH "VIRTUAL EVENTS"
100109 .PP
66 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
77 '\"
88 '\" SOURCE: entry.n, r1.12
9 '\" RCS: @(#) $Id: ttk_entry.n,v 1.13 2008/09/23 13:36:56 dkf Exp $
9 '\" RCS: @(#) $Id: ttk_entry.n,v 1.15 2008/11/24 09:56:44 dkf Exp $
1010 '\"
1111 .so man.macros
1212 .TH ttk::entry n 8.5 Tk "Tk Themed Widget"
133133 It is an error to use this form if the selection is not in the
134134 entry window.
135135 .LP
136 Abbreviations may be used for any of the forms above, e.g.
136 Abbreviations may be used for any of the forms above, e.g.\|
137137 .QW \fBe\fR
138138 or
139 .QW \fBsel.f\fR .
139 .QW \fBsel.l\fR .
140140 In general, out-of-range indices are automatically rounded to the
141141 nearest legal value.
142142 .SH "WIDGET COMMAND"
143143 .PP
144 The following commands are possible for entry widgets:
144 The following subcommands are possible for entry widgets:
145145 .TP
146146 \fIpathName \fBbbox \fIindex\fR
147147 Returns a list of four numbers describing the bounding box of the
152152 the width and height of the character, in pixels.
153153 The bounding box may refer to a region outside the visible area
154154 of the window.
155 .TP
156 \fIpathName \fBcget\fR \fIoption\fR
157 Returns the current value of the specified \fIoption\fR.
158 See \fIttk::widget(n)\fR.
159 .TP
160 \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
161 Modify or query widget options.
162 See \fIttk::widget(n)\fR.
155 '\".TP
156 '\"\fIpathName \fBcget\fR \fIoption\fR
157 '\"Returns the current value of the specified \fIoption\fR.
158 '\"See \fIttk::widget(n)\fR.
159 '\".TP
160 '\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
161 '\"Modify or query widget options.
162 '\"See \fIttk::widget(n)\fR.
163163 .TP
164164 \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
165165 Delete one or more elements of the entry.
176176 \fIpathName \fBicursor \fIindex\fR
177177 Arrange for the insert cursor to be displayed just before the character
178178 given by \fIindex\fR. Returns the empty string.
179 .TP
180 \fIpathName \fBidentify \fIx y\fR
181 Returns the name of the element at position \fIx\fR, \fIy\fR,
182 or the empty string if the coordinates are outside the window.
179 '\".TP
180 '\"\fIpathName \fBidentify \fIx y\fR
181 '\"Returns the name of the element at position \fIx\fR, \fIy\fR,
182 '\"or the empty string if the coordinates are outside the window.
183183 .TP
184184 \fIpathName \fBindex\fI index\fR
185185 Returns the numerical index corresponding to \fIindex\fR.
187187 \fIpathName \fBinsert \fIindex string\fR
188188 Insert \fIstring\fR just before the character
189189 indicated by \fIindex\fR. Returns the empty string.
190 .TP
191 \fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
192 Test the widget state.
193 See \fIttk::widget(n)\fR.
190 '\".TP
191 '\"\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR?
192 '\"Test the widget state.
193 '\"See \fIttk::widget(n)\fR.
194194 .TP
195195 \fIpathName \fBselection \fIoption arg\fR
196196 This command is used to adjust the selection within an entry. It
213213 If \fIend\fR refers to the same character as \fIstart\fR or an
214214 earlier one, then the entry's selection is cleared.
215215 .RE
216 .TP
217 \fIpathName \fBstate\fR ?\fIstateSpec\fR?
218 Modify or query the widget state.
219 See \fIttk::widget(n)\fR.
216 '\".TP
217 '\"\fIpathName \fBstate\fR ?\fIstateSpec\fR?
218 '\"Modify or query the widget state.
219 '\"See \fIttk::widget(n)\fR.
220220 .TP
221221 \fIpathName \fBvalidate\fR
222222 Force revalidation, independent of the conditions specified
223223 by the \fB\-validate\fR option.
224224 Returns 0 if validation fails, 1 if it succeeds.
225225 Sets or clears the \fBinvalid\fR state accordingly.
226 See \fBVALIDATION\fR below for more details.
226227 .TP
227228 \fIpathName \fBxview \fIargs\fR
228229 This command is used to query and change the horizontal position of the
262263 become visible; if it is positive then characters farther to the right
263264 become visible.
264265 .RE
266 .PP
267 The entry widget also supports the following generic \fBttk::widget\fR
268 widget subcommands (see \fIttk::widget(n)\fR for details):
269 .DS
270 .ta 5.5c 11c
271 \fBcget\fR \fBconfigure\fR \fBidentify\fR
272 \fBinstate\fR \fBstate\fR
273 .DE
265274 .SH VALIDATION
266275 .PP
267276 The \fB\-validate\fR, \fB\-validatecommand\fR, and \fB\-invalidcommand\fR
277286 .PP
278287 The \fB\-validate\fR option determines when validation occurs;
279288 it may be set to any of the following values:
289 .RS
280290 .IP \fBnone\fR
281291 Default. This means validation will only occur when
282292 specifically requested by the \fBvalidate\fR widget command.
293303 The entry is revalidated when the entry loses focus.
294304 .IP \fBall\fR
295305 Validation is performed for all above conditions.
306 .RE
296307 .PP
297308 The \fB\-invalidcommand\fR is evaluated whenever
298309 the \fB\-validatecommand\fR returns a false value.
310321 .SS "VALIDATION SCRIPT SUBSTITUTIONS"
311322 .PP
312323 It is possible to perform percent substitutions on the
313 \fB\-validatecommand\fR and \fBinvalidCommand\fR,
324 \fB\-validatecommand\fR and \fB\-invalidcommand\fR,
314325 just as in a \fBbind\fR script.
315326 The following substitutions are recognized:
327 .RS
316328 .IP \fB%d\fR
317329 Type of action: 1 for \fBinsert\fR prevalidation,
318330 0 for \fBdelete\fR prevalidation,
333345 (\fBkey\fR, \fBfocusin\fR, \fBfocusout\fR, or \fBforced\fR).
334346 .IP \fB%W\fR
335347 The name of the entry widget.
348 .RE
336349 .SS "DIFFERENCES FROM TK ENTRY WIDGET VALIDATION"
337 .IP \(bu
350 .PP
338351 The standard Tk entry widget automatically disables validation
339352 (by setting \fB\-validate\fR to \fBnone\fR)
340353 if the \fB\-validatecommand\fR or \fB\-invalidcommand\fR modifies
342355 The Tk themed entry widget only disables validation if one
343356 of the validation scripts raises an error, or if \fB\-validatecommand\fR
344357 does not return a valid boolean value.
345 (Thus, it is not necessary to reenable validation after
358 (Thus, it is not necessary to re-enable validation after
346359 modifying the entry value in a validation script).
347 .IP \(bu
348 The standard entry widget invokes validation whenever the linked
360 .PP
361 In addition, the standard entry widget invokes validation whenever the linked
349362 \fB\-textvariable\fR is modified; the Tk themed entry widget does not.
350363 .SH "DEFAULT BINDINGS"
351364 .PP
355368 refers to a contiguous group of letters, digits, or
356369 .QW _
357370 characters, or any single character other than these.
358 .IP \(bu
371 .IP \0\(bu 4
359372 Clicking mouse button 1 positions the insert cursor
360373 just before the character underneath the mouse cursor, sets the
361374 input focus to this widget, and clears any selection in the widget.
362375 Dragging with mouse button 1 down strokes out a selection between
363376 the insert cursor and the character under the mouse.
364 .IP \(bu
377 .IP \0\(bu 4
365378 Double-clicking with mouse button 1 selects the word under the mouse
366379 and positions the insert cursor at the end of the word.
367380 Dragging after a double click strokes out a selection consisting
368381 of whole words.
369 .IP \(bu
382 .IP \0\(bu 4
370383 Triple-clicking with mouse button 1 selects all of the text in the
371384 entry and positions the insert cursor at the end of the line.
372 .IP \(bu
385 .IP \0\(bu 4
373386 The ends of the selection can be adjusted by dragging with mouse
374387 button 1 while the Shift key is down.
375388 If the button is double-clicked before dragging then the selection
376389 will be adjusted in units of whole words.
377 .IP \(bu
390 .IP \0\(bu 4
378391 Clicking mouse button 1 with the Control key down will position the
379392 insert cursor in the entry without affecting the selection.
380 .IP \(bu
393 .IP \0\(bu 4
381394 If any normal printing characters are typed in an entry, they are
382395 inserted at the point of the insert cursor.
383 .IP \(bu
396 .IP \0\(bu 4
384397 The view in the entry can be adjusted by dragging with mouse button 2.
385398 If mouse button 2 is clicked without moving the mouse, the selection
386399 is copied into the entry at the position of the mouse cursor.
387 .IP \(bu
400 .IP \0\(bu 4
388401 If the mouse is dragged out of the entry on the left or right sides
389402 while button 1 is pressed, the entry will automatically scroll to
390403 make more text visible (if there is more text off-screen on the side
391404 where the mouse left the window).
392 .IP \(bu
405 .IP \0\(bu 4
393406 The Left and Right keys move the insert cursor one character to the
394407 left or right; they also clear any selection in the entry.
395408 If Left or Right is typed with the Shift key down, then the insertion
398411 Control-Shift-Left and Control-Shift-Right move the insert cursor
399412 by words and also extend the selection.
400413 Control-b and Control-f behave the same as Left and Right, respectively.
401 .IP \(bu
414 .IP \0\(bu 4
402415 The Home key and Control-a move the insert cursor to the
403416 beginning of the entry and clear any selection in the entry.
404417 Shift-Home moves the insert cursor to the beginning of the entry
405418 and extends the selection to that point.
406 .IP \(bu
419 .IP \0\(bu 4
407420 The End key and Control-e move the insert cursor to the
408421 end of the entry and clear any selection in the entry.
409422 Shift-End moves the cursor to the end and extends the selection
410423 to that point.
411 .IP \(bu
424 .IP \0\(bu 4
412425 Control-/ selects all the text in the entry.
413 .IP \(bu
426 .IP \0\(bu 4
414427 Control-\e clears any selection in the entry.
415 .IP \(bu
428 .IP \0\(bu 4
416429 The standard Tk <<Cut>>, <<Copy>>, <<Paste>>, and <<Clear>>
417430 virtual events operate on the selection in the expected manner.
418 .IP \(bu
431 .IP \0\(bu 4
419432 The Delete key deletes the selection, if there is one in the entry.
420433 If there is no selection, it deletes the character to the right of
421434 the insert cursor.
422 .IP \(bu
435 .IP \0\(bu 4
423436 The BackSpace key and Control-h delete the selection, if there is one
424437 in the entry.
425438 If there is no selection, it deletes the character to the left of
426439 the insert cursor.
427 .IP \(bu
440 .IP \0\(bu 4
428441 Control-d deletes the character to the right of the insert cursor.
429 .IP \(bu
442 .IP \0\(bu 4
430443 Control-k deletes all the characters to the right of the insertion
431444 cursor.
432445 .SH "WIDGET STATES"
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: ttk_menubutton.n,v 1.12 2008/09/23 13:36:57 dkf Exp $
6 '\" RCS: @(#) $Id: ttk_menubutton.n,v 1.13 2008/12/04 15:47:22 dkf Exp $
77 '\"
88 .so man.macros
99 .TH ttk::menubutton n 8.5 Tk "Tk Themed Widget"
4242 Menubutton widgets support the standard
4343 \fBcget\fR, \fBconfigure\fR, \fBidentify\fR, \fBinstate\fR, and \fBstate\fR
4444 methods. No other widget methods are used.
45 .SH "STANDARD STYLES"
46 .PP
47 \fBTtk::menubutton\fR widgets support the \fBToolbutton\fR style in all
48 standard themes, which is useful for creating widgets for toolbars.
4549 .SH "SEE ALSO"
4650 ttk::widget(n), menu(n), menubutton(n)
4751 .SH "KEYWORDS"
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: ttk_panedwindow.n,v 1.18 2008/09/23 13:36:57 dkf Exp $
6 '\" RCS: @(#) $Id: ttk_panedwindow.n,v 1.19 2008/11/19 20:17:34 jenglish Exp $
77 '\"
88 .so man.macros
99 .TH ttk::panedwindow n 8.5 Tk "Tk Themed Widget"
5757 .TP
5858 \fIpathname \fBadd\fR \fIsubwindow\fR \fIoptions...\fR
5959 Adds a new pane to the window.
60 \fIsubwindow\fR must be a direct child of the paned window \fIpathname\fR.
6160 See \fBPANE OPTIONS\fR for the list of available options.
6261 .TP
6362 \fIpathname \fBforget\fR \fIpane\fR
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: ttk_radiobutton.n,v 1.14 2008/09/23 13:36:57 dkf Exp $
6 '\" RCS: @(#) $Id: ttk_radiobutton.n,v 1.15 2008/12/04 15:47:22 dkf Exp $
77 '\"
88 .so man.macros
99 .TH ttk::radiobutton n 8.5 Tk "Tk Themed Widget"
6262 or
6363 .QW indeterminate
6464 selection.)
65 .SH "STANDARD STYLES"
66 .PP
67 \fBTtk::radiobutton\fR widgets support the \fBToolbutton\fR style in all
68 standard themes, which is useful for creating widgets for toolbars.
6569 .SH "SEE ALSO"
6670 ttk::widget(n), ttk::checkbutton(n), radiobutton(n)
6771 .SH "KEYWORDS"
0 '\"
1 '\" Copyright (c) 2008 Pat Thoyts
2 '\"
3 '\" See the file "license.terms" for information on usage and redistribution
4 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 '\"
6 '\" RCS: @(#) $Id: ttk_spinbox.n,v 1.2 2008/11/24 09:56:44 dkf Exp $
7 '\"
8 .so man.macros
9 .TH ttk::spinbox n 8.5 Tk "Tk Themed Widget"
10 .BS
11 .SH NAME
12 ttk::spinbox \- Selecting text field widget
13 .SH SYNOPSIS
14 \fBttk::spinbox\fR \fIpathName \fR?\fIoptions\fR?
15 .BE
16 .SH DESCRIPTION
17 .PP
18 A \fBttk::spinbox\fR widget is a \fBttk::entry\fR widget with built-in
19 up and down buttons that are used to either modify a numeric value or
20 to select among a set of values. The widget implements all the features
21 of the \fBttk::entry\fR widget including support of the
22 \fB\-textvariable\fR option to link the value displayed by the widget
23 to a Tcl variable.
24 .SO ttk_widget
25 \-class \-cursor \-style
26 \-takefocus \-xscrollcommand
27 .SE
28 .SO ttk_entry
29 \-validate \-validatecommand
30 .SE
31 .SH "WIDGET-SPECIFIC OPTIONS"
32 .OP \-from from From
33 A floating\-point value specifying the lowest value for the spinbox. This is
34 used in conjunction with \fI\-to\fR and \fI\-increment\fR to set a numerical
35 range.
36 .OP \-to to To
37 A floating\-point value specifying the highest permissible value for the
38 widget. See also \fI\-from\fR and \fI\-increment\fR.
39 range.
40 .OP \-increment increment Increment
41 A floating\-point value specifying the change in value to be applied each
42 time one of the widget spin buttons is pressed. The up button applies a
43 positive increment, the down button applies a negative increment.
44 .OP \-values values Values
45 This must be a Tcl list of values. If this option is set then this will
46 override any range set using the \fI\-from\fR, \fI\-to\fR and
47 \fI\-increment\fR options. The widget will instead use the values
48 specified beginning with the first value.
49 .OP \-wrap wrap Wrap
50 Must be a proper boolean value. If on, the spinbox will wrap around the
51 values of data in the widget.
52 .OP \-format format Format
53 Specifies an alternate format to use when setting the string value
54 when using the \fB\-from\fR and \fB\-to\fR range.
55 This must be a format specifier of the form \fB%<pad>.<pad>f\fR,
56 as it will format a floating-point number.
57 .OP \-command command Command
58 Specifies a Tcl command to be invoked whenever a spinbutton is invoked.
59 .SH "INDICES"
60 .PP
61 See the \fBttk::entry\fR manual for information about indexing characters.
62 .SH "VALIDATION"
63 .PP
64 See the \fBttk::entry\fR manual for information about using the
65 \fI\-validate\fR and \fI\-validatecommand\fR options.
66 .SH "WIDGET COMMAND"
67 .PP
68 The following subcommands are possible for spinbox widgets in addition to
69 the commands described for the \fBttk::entry\fR widget:
70 .TP
71 \fIpathName \fBcurrent \fIindex\fR
72 .TP
73 \fIpathName \fBget\fR
74 Returns the spinbox's current value.
75 .TP
76 \fIpathName \fBset \fIvalue\fR
77 Set the spinbox string to \fIvalue\fR. If a \fI\-format\fR option has
78 been configured then this format will be applied. If formatting fails
79 or is not set or the \fI\-values\fR option has been used then the value
80 is set directly.
81 .SH "SEE ALSO"
82 ttk::widget(n), ttk::entry(n), spinbox(n)
83 .SH KEYWORDS
84 entry, spinbox, widget, text field
85 '\" Local Variables:
86 '\" mode: nroff
87 '\" End:
33 '\" See the file "license.terms" for information on usage and redistribution
44 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
55 '\"
6 '\" RCS: @(#) $Id: ttk_widget.n,v 1.16 2008/09/23 13:36:58 dkf Exp $
6 '\" RCS: @(#) $Id: ttk_widget.n,v 1.17 2008/12/03 18:44:49 jenglish Exp $
77 '\"
88 .so man.macros
99 .TH ttk::widget n 8.5 Tk "Tk Themed Widget"
233233 The widget's value is invalid.
234234 (Potential uses: scale widget value out of bounds,
235235 entry widget value failed validation.)
236 .TP
237 \fBhover\fR
238 The mouse cursor is within the widget.
239 This is similar to the \fBactive\fP state;
240 it is used in some themes for widgets that
241 provide distinct visual feedback for
242 the active widget in addition to the active element
243 within the widget.
236244 .PP
237245 A \fIstate specification\fR or \fIstateSpec\fR is a list
238246 of state names, optionally prefixed with an exclamation point (!)
44 '\" See the file "license.terms" for information on usage and redistribution
55 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
66 '\"
7 '\" RCS: @(#) $Id: wm.n,v 1.40 2008/09/23 13:36:58 dkf Exp $
7 '\" RCS: @(#) $Id: wm.n,v 1.42 2008/11/16 17:07:51 dkf Exp $
88 '\"
99 .so man.macros
1010 .TH wm n 8.5 Tk "Tk Built-In Commands"
441441 \fBwm manage \fIwidget\fR
442442 .
443443 The \fIwidget\fR specified will become a stand alone top-level window. The
444 window will be decorated with the window managers title bar, etc.
444 window will be decorated with the window managers title bar, etc. Only
445 \fIframe\fR, \fIlabelframe\fR and \fItoplevel\fR widgets can be used
446 with this command. Attempting to pass any other widget type will raise
447 an error. Attempting to manage a \fItoplevel\fR widget is benign and
448 achieves nothing. See also \fBGEOMETRY MANAGEMENT\fR.
445449 .TP
446450 \fBwm maxsize \fIwindow\fR ?\fIwidth height\fR?
447451 .
485489 that the window will not be reparented from the root window into a
486490 decorative frame and the user will not be able to manipulate the
487491 window using the normal window manager mechanisms.
492 .RS
493 .PP
494 Note that the override-redirect flag is only guaranteed to be taken notice of
495 when the window is first mapped or when mapped after the state is changed from
496 withdrawn to normal. Some, but not all, platforms will take notice at
497 additional times.
498 .RE
488499 .TP
489500 \fBwm positionfrom \fIwindow\fR ?\fIwho\fR?
490501 .
99 * See the file "license.terms" for information on usage and redistribution
1010 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: default.h,v 1.5 2004/03/17 18:15:42 das Exp $
12 * RCS: @(#) $Id: default.h,v 1.6 2008/11/06 22:19:00 nijtmans Exp $
1313 */
1414
1515 #ifndef _DEFAULT
1616 #define _DEFAULT
1717
1818 #if defined(__WIN32__) || defined(_WIN32) || \
19 defined(__CYGWIN__) || defined(__MINGW32__)
19 defined(__MINGW32__)
2020 # include "tkWinDefault.h"
2121 #else
2222 # if defined(MAC_OSX_TK)
+0
-284
generic/prolog.ps less more
0 %%BeginProlog
1 50 dict begin
2
3 % This is a standard prolog for Postscript generated by Tk's canvas
4 % widget.
5 % RCS: @(#) $Id: prolog.ps,v 1.2 1999/04/16 01:51:09 stanton Exp $
6
7 % The definitions below just define all of the variables used in
8 % any of the procedures here. This is needed for obscure reasons
9 % explained on p. 716 of the Postscript manual (Section H.2.7,
10 % "Initializing Variables," in the section on Encapsulated Postscript).
11
12 /baseline 0 def
13 /stipimage 0 def
14 /height 0 def
15 /justify 0 def
16 /lineLength 0 def
17 /spacing 0 def
18 /stipple 0 def
19 /strings 0 def
20 /xoffset 0 def
21 /yoffset 0 def
22 /tmpstip null def
23
24 % Define the array ISOLatin1Encoding (which specifies how characters are
25 % encoded for ISO-8859-1 fonts), if it isn't already present (Postscript
26 % level 2 is supposed to define it, but level 1 doesn't).
27
28 systemdict /ISOLatin1Encoding known not {
29 /ISOLatin1Encoding [
30 /space /space /space /space /space /space /space /space
31 /space /space /space /space /space /space /space /space
32 /space /space /space /space /space /space /space /space
33 /space /space /space /space /space /space /space /space
34 /space /exclam /quotedbl /numbersign /dollar /percent /ampersand
35 /quoteright
36 /parenleft /parenright /asterisk /plus /comma /minus /period /slash
37 /zero /one /two /three /four /five /six /seven
38 /eight /nine /colon /semicolon /less /equal /greater /question
39 /at /A /B /C /D /E /F /G
40 /H /I /J /K /L /M /N /O
41 /P /Q /R /S /T /U /V /W
42 /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
43 /quoteleft /a /b /c /d /e /f /g
44 /h /i /j /k /l /m /n /o
45 /p /q /r /s /t /u /v /w
46 /x /y /z /braceleft /bar /braceright /asciitilde /space
47 /space /space /space /space /space /space /space /space
48 /space /space /space /space /space /space /space /space
49 /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
50 /dieresis /space /ring /cedilla /space /hungarumlaut /ogonek /caron
51 /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
52 /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen
53 /registered /macron
54 /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph
55 /periodcentered
56 /cedillar /onesuperior /ordmasculine /guillemotright /onequarter
57 /onehalf /threequarters /questiondown
58 /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
59 /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex
60 /Idieresis
61 /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
62 /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn
63 /germandbls
64 /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
65 /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex
66 /idieresis
67 /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
68 /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn
69 /ydieresis
70 ] def
71 } if
72
73 % font ISOEncode font
74 % This procedure changes the encoding of a font from the default
75 % Postscript encoding to ISOLatin1. It's typically invoked just
76 % before invoking "setfont". The body of this procedure comes from
77 % Section 5.6.1 of the Postscript book.
78
79 /ISOEncode {
80 dup length dict begin
81 {1 index /FID ne {def} {pop pop} ifelse} forall
82 /Encoding ISOLatin1Encoding def
83 currentdict
84 end
85
86 % I'm not sure why it's necessary to use "definefont" on this new
87 % font, but it seems to be important; just use the name "Temporary"
88 % for the font.
89
90 /Temporary exch definefont
91 } bind def
92
93 % StrokeClip
94 %
95 % This procedure converts the current path into a clip area under
96 % the assumption of stroking. It's a bit tricky because some Postscript
97 % interpreters get errors during strokepath for dashed lines. If
98 % this happens then turn off dashes and try again.
99
100 /StrokeClip {
101 {strokepath} stopped {
102 (This Postscript printer gets limitcheck overflows when) =
103 (stippling dashed lines; lines will be printed solid instead.) =
104 [] 0 setdash strokepath} if
105 clip
106 } bind def
107
108 % desiredSize EvenPixels closestSize
109 %
110 % The procedure below is used for stippling. Given the optimal size
111 % of a dot in a stipple pattern in the current user coordinate system,
112 % compute the closest size that is an exact multiple of the device's
113 % pixel size. This allows stipple patterns to be displayed without
114 % aliasing effects.
115
116 /EvenPixels {
117 % Compute exact number of device pixels per stipple dot.
118 dup 0 matrix currentmatrix dtransform
119 dup mul exch dup mul add sqrt
120
121 % Round to an integer, make sure the number is at least 1, and compute
122 % user coord distance corresponding to this.
123 dup round dup 1 lt {pop 1} if
124 exch div mul
125 } bind def
126
127 % width height string StippleFill --
128 %
129 % Given a path already set up and a clipping region generated from
130 % it, this procedure will fill the clipping region with a stipple
131 % pattern. "String" contains a proper image description of the
132 % stipple pattern and "width" and "height" give its dimensions. Each
133 % stipple dot is assumed to be about one unit across in the current
134 % user coordinate system. This procedure trashes the graphics state.
135
136 /StippleFill {
137 % The following code is needed to work around a NeWSprint bug.
138
139 /tmpstip 1 index def
140
141 % Change the scaling so that one user unit in user coordinates
142 % corresponds to the size of one stipple dot.
143 1 EvenPixels dup scale
144
145 % Compute the bounding box occupied by the path (which is now
146 % the clipping region), and round the lower coordinates down
147 % to the nearest starting point for the stipple pattern. Be
148 % careful about negative numbers, since the rounding works
149 % differently on them.
150
151 pathbbox
152 4 2 roll
153 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll
154 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll
155
156 % Stack now: width height string y1 y2 x1 x2
157 % Below is a doubly-nested for loop to iterate across this area
158 % in units of the stipple pattern size, going up columns then
159 % across rows, blasting out a stipple-pattern-sized rectangle at
160 % each position
161
162 6 index exch {
163 2 index 5 index 3 index {
164 % Stack now: width height string y1 y2 x y
165
166 gsave
167 1 index exch translate
168 5 index 5 index true matrix tmpstip imagemask
169 grestore
170 } for
171 pop
172 } for
173 pop pop pop pop pop
174 } bind def
175
176 % -- AdjustColor --
177 % Given a color value already set for output by the caller, adjusts
178 % that value to a grayscale or mono value if requested by the CL
179 % variable.
180
181 /AdjustColor {
182 CL 2 lt {
183 currentgray
184 CL 0 eq {
185 .5 lt {0} {1} ifelse
186 } if
187 setgray
188 } if
189 } bind def
190
191 % x y strings spacing xoffset yoffset justify stipple DrawText --
192 % This procedure does all of the real work of drawing text. The
193 % color and font must already have been set by the caller, and the
194 % following arguments must be on the stack:
195 %
196 % x, y - Coordinates at which to draw text.
197 % strings - An array of strings, one for each line of the text item,
198 % in order from top to bottom.
199 % spacing - Spacing between lines.
200 % xoffset - Horizontal offset for text bbox relative to x and y: 0 for
201 % nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se.
202 % yoffset - Vertical offset for text bbox relative to x and y: 0 for
203 % nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se.
204 % justify - 0 for left justification, 0.5 for center, 1 for right justify.
205 % stipple - Boolean value indicating whether or not text is to be
206 % drawn in stippled fashion. If text is stippled,
207 % procedure StippleText must have been defined to call
208 % StippleFill in the right way.
209 %
210 % Also, when this procedure is invoked, the color and font must already
211 % have been set for the text.
212
213 /DrawText {
214 /stipple exch def
215 /justify exch def
216 /yoffset exch def
217 /xoffset exch def
218 /spacing exch def
219 /strings exch def
220
221 % First scan through all of the text to find the widest line.
222
223 /lineLength 0 def
224 strings {
225 stringwidth pop
226 dup lineLength gt {/lineLength exch def} {pop} ifelse
227 newpath
228 } forall
229
230 % Compute the baseline offset and the actual font height.
231
232 0 0 moveto (TXygqPZ) false charpath
233 pathbbox dup /baseline exch def
234 exch pop exch sub /height exch def pop
235 newpath
236
237 % Translate coordinates first so that the origin is at the upper-left
238 % corner of the text's bounding box. Remember that x and y for
239 % positioning are still on the stack.
240
241 translate
242 lineLength xoffset mul
243 strings length 1 sub spacing mul height add yoffset mul translate
244
245 % Now use the baseline and justification information to translate so
246 % that the origin is at the baseline and positioning point for the
247 % first line of text.
248
249 justify lineLength mul baseline neg translate
250
251 % Iterate over each of the lines to output it. For each line,
252 % compute its width again so it can be properly justified, then
253 % display it.
254
255 strings {
256 dup stringwidth pop
257 justify neg mul 0 moveto
258 stipple {
259
260 % The text is stippled, so turn it into a path and print
261 % by calling StippledText, which in turn calls StippleFill.
262 % Unfortunately, many Postscript interpreters will get
263 % overflow errors if we try to do the whole string at
264 % once, so do it a character at a time.
265
266 gsave
267 /char (X) def
268 {
269 char 0 3 -1 roll put
270 currentpoint
271 gsave
272 char true charpath clip StippleText
273 grestore
274 char stringwidth translate
275 moveto
276 } forall
277 grestore
278 } {show} ifelse
279 0 spacing neg translate
280 } forall
281 } bind def
282
283 %%EndProlog
99 #
1010 # See the file "license.terms" for information on usage and redistribution
1111 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 #
13 # RCS: @(#) $Id: tk.decls,v 1.39 2008/04/02 21:31:17 das Exp $
12 #
13 # RCS: @(#) $Id: tk.decls,v 1.45 2008/11/12 00:15:24 nijtmans Exp $
1414
1515 library tk
1616
4949 int relief)
5050 }
5151 declare 5 generic {
52 void Tk_AddOption(Tk_Window tkwin, CONST char *name,
53 CONST char *value, int priority)
52 void Tk_AddOption(Tk_Window tkwin, const char *name,
53 const char *value, int priority)
5454 }
5555 declare 6 generic {
5656 void Tk_BindEvent(Tk_BindingTable bindingTable,
6868 }
6969 declare 9 generic {
7070 int Tk_CanvasGetCoord(Tcl_Interp *interp,
71 Tk_Canvas canvas, CONST char *str, double *doublePtr)
71 Tk_Canvas canvas, const char *str, double *doublePtr)
7272 }
7373 declare 10 generic {
7474 Tk_CanvasTextInfo *Tk_CanvasGetTextInfo(Tk_Canvas canvas)
102102 }
103103 declare 18 generic {
104104 int Tk_CanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp,
105 Tk_Window tkwin, CONST char *value, char *widgRec, int offset)
105 Tk_Window tkwin, const char *value, char *widgRec, int offset)
106106 }
107107 declare 19 generic {
108 char * Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin,
108 CONST86 char * Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin,
109109 char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
110110 }
111111 declare 20 generic {
136136 declare 27 generic {
137137 int Tk_ConfigureInfo(Tcl_Interp *interp,
138138 Tk_Window tkwin, Tk_ConfigSpec *specs,
139 char *widgRec, CONST char *argvName, int flags)
139 char *widgRec, const char *argvName, int flags)
140140 }
141141 declare 28 generic {
142142 int Tk_ConfigureValue(Tcl_Interp *interp,
143143 Tk_Window tkwin, Tk_ConfigSpec *specs,
144 char *widgRec, CONST char *argvName, int flags)
144 char *widgRec, const char *argvName, int flags)
145145 }
146146 declare 29 generic {
147147 int Tk_ConfigureWidget(Tcl_Interp *interp,
155155 }
156156 declare 31 generic {
157157 Tk_TextLayout Tk_ComputeTextLayout(Tk_Font font,
158 CONST char *str, int numChars, int wrapLength,
158 const char *str, int numChars, int wrapLength,
159159 Tk_Justify justify, int flags, int *widthPtr,
160160 int *heightPtr)
161161 }
165165 declare 33 generic {
166166 unsigned long Tk_CreateBinding(Tcl_Interp *interp,
167167 Tk_BindingTable bindingTable, ClientData object,
168 CONST char *eventStr, CONST char *command, int append)
168 const char *eventStr, const char *command, int append)
169169 }
170170 declare 34 generic {
171171 Tk_BindingTable Tk_CreateBindingTable(Tcl_Interp *interp)
184184 void Tk_CreateGenericHandler(Tk_GenericProc *proc, ClientData clientData)
185185 }
186186 declare 38 generic {
187 void Tk_CreateImageType(Tk_ImageType *typePtr)
187 void Tk_CreateImageType(const Tk_ImageType *typePtr)
188188 }
189189 declare 39 generic {
190190 void Tk_CreateItemType(Tk_ItemType *typePtr)
191191 }
192192 declare 40 generic {
193 void Tk_CreatePhotoImageFormat(Tk_PhotoImageFormat *formatPtr)
193 void Tk_CreatePhotoImageFormat(const Tk_PhotoImageFormat *formatPtr)
194194 }
195195 declare 41 generic {
196196 void Tk_CreateSelHandler(Tk_Window tkwin,
200200 }
201201 declare 42 generic {
202202 Tk_Window Tk_CreateWindow(Tcl_Interp *interp,
203 Tk_Window parent, CONST char *name, CONST char *screenName)
203 Tk_Window parent, const char *name, const char *screenName)
204204 }
205205 declare 43 generic {
206206 Tk_Window Tk_CreateWindowFromPath(Tcl_Interp *interp, Tk_Window tkwin,
207 CONST char *pathName, CONST char *screenName)
207 const char *pathName, const char *screenName)
208208 }
209209 declare 44 generic {
210 int Tk_DefineBitmap(Tcl_Interp *interp, CONST char *name,
211 CONST char *source, int width, int height)
210 int Tk_DefineBitmap(Tcl_Interp *interp, const char *name,
211 const char *source, int width, int height)
212212 }
213213 declare 45 generic {
214214 void Tk_DefineCursor(Tk_Window window, Tk_Cursor cursor)
219219 declare 47 generic {
220220 int Tk_DeleteBinding(Tcl_Interp *interp,
221221 Tk_BindingTable bindingTable, ClientData object,
222 CONST char *eventStr)
222 const char *eventStr)
223223 }
224224 declare 48 generic {
225225 void Tk_DeleteBindingTable(Tk_BindingTable bindingTable)
236236 void Tk_DeleteGenericHandler(Tk_GenericProc *proc, ClientData clientData)
237237 }
238238 declare 52 generic {
239 void Tk_DeleteImage(Tcl_Interp *interp, CONST char *name)
239 void Tk_DeleteImage(Tcl_Interp *interp, const char *name)
240240 }
241241 declare 53 generic {
242242 void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target)
263263 }
264264 declare 59 generic {
265265 void Tk_DrawChars(Display *display, Drawable drawable, GC gc,
266 Tk_Font tkfont, CONST char *source, int numBytes, int x, int y)
266 Tk_Font tkfont, const char *source, int numBytes, int x, int y)
267267 }
268268 declare 60 generic {
269269 void Tk_DrawFocusHighlight(Tk_Window tkwin, GC gc, int width,
287287 int relief)
288288 }
289289 declare 64 generic {
290 Tk_PhotoHandle Tk_FindPhoto(Tcl_Interp *interp, CONST char *imageName)
290 Tk_PhotoHandle Tk_FindPhoto(Tcl_Interp *interp, const char *imageName)
291291 }
292292 declare 65 generic {
293293 Font Tk_FontId(Tk_Font font)
345345 }
346346 declare 82 generic {
347347 int Tk_GetAnchor(Tcl_Interp *interp,
348 CONST char *str, Tk_Anchor *anchorPtr)
348 const char *str, Tk_Anchor *anchorPtr)
349349 }
350350 declare 83 generic {
351351 CONST84_RETURN char * Tk_GetAtomName(Tk_Window tkwin, Atom atom)
353353 declare 84 generic {
354354 CONST84_RETURN char * Tk_GetBinding(Tcl_Interp *interp,
355355 Tk_BindingTable bindingTable, ClientData object,
356 CONST char *eventStr)
356 const char *eventStr)
357357 }
358358 declare 85 generic {
359 Pixmap Tk_GetBitmap(Tcl_Interp *interp, Tk_Window tkwin, CONST char * str)
359 Pixmap Tk_GetBitmap(Tcl_Interp *interp, Tk_Window tkwin, const char * str)
360360 }
361361 declare 86 generic {
362362 Pixmap Tk_GetBitmapFromData(Tcl_Interp *interp,
363 Tk_Window tkwin, CONST char *source, int width, int height)
363 Tk_Window tkwin, const char *source, int width, int height)
364364 }
365365 declare 87 generic {
366 int Tk_GetCapStyle(Tcl_Interp *interp, CONST char *str, int *capPtr)
366 int Tk_GetCapStyle(Tcl_Interp *interp, const char *str, int *capPtr)
367367 }
368368 declare 88 generic {
369369 XColor * Tk_GetColor(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name)
373373 }
374374 declare 90 generic {
375375 Colormap Tk_GetColormap(Tcl_Interp *interp, Tk_Window tkwin,
376 CONST char *str)
376 const char *str)
377377 }
378378 declare 91 generic {
379379 Tk_Cursor Tk_GetCursor(Tcl_Interp *interp, Tk_Window tkwin,
381381 }
382382 declare 92 generic {
383383 Tk_Cursor Tk_GetCursorFromData(Tcl_Interp *interp,
384 Tk_Window tkwin, CONST char *source, CONST char *mask,
384 Tk_Window tkwin, const char *source, const char *mask,
385385 int width, int height, int xHot, int yHot,
386386 Tk_Uid fg, Tk_Uid bg)
387387 }
388388 declare 93 generic {
389389 Tk_Font Tk_GetFont(Tcl_Interp *interp,
390 Tk_Window tkwin, CONST char *str)
390 Tk_Window tkwin, const char *str)
391391 }
392392 declare 94 generic {
393393 Tk_Font Tk_GetFontFromObj(Tk_Window tkwin, Tcl_Obj *objPtr)
399399 GC Tk_GetGC(Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr)
400400 }
401401 declare 97 generic {
402 Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, CONST char *name,
402 Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name,
403403 Tk_ImageChangedProc *changeProc, ClientData clientData)
404404 }
405405 declare 98 generic {
406406 ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
407 CONST char *name, Tk_ImageType **typePtrPtr)
407 const char *name, CONST86 Tk_ImageType **typePtrPtr)
408408 }
409409 declare 99 generic {
410410 Tk_ItemType * Tk_GetItemTypes(void)
411411 }
412412 declare 100 generic {
413 int Tk_GetJoinStyle(Tcl_Interp *interp, CONST char *str, int *joinPtr)
413 int Tk_GetJoinStyle(Tcl_Interp *interp, const char *str, int *joinPtr)
414414 }
415415 declare 101 generic {
416416 int Tk_GetJustify(Tcl_Interp *interp,
417 CONST char *str, Tk_Justify *justifyPtr)
417 const char *str, Tk_Justify *justifyPtr)
418418 }
419419 declare 102 generic {
420420 int Tk_GetNumMainWindows(void)
421421 }
422422 declare 103 generic {
423 Tk_Uid Tk_GetOption(Tk_Window tkwin, CONST char *name,
424 CONST char *className)
423 Tk_Uid Tk_GetOption(Tk_Window tkwin, const char *name,
424 const char *className)
425425 }
426426 declare 104 generic {
427427 int Tk_GetPixels(Tcl_Interp *interp,
428 Tk_Window tkwin, CONST char *str, int *intPtr)
428 Tk_Window tkwin, const char *str, int *intPtr)
429429 }
430430 declare 105 generic {
431431 Pixmap Tk_GetPixmap(Display *display, Drawable d,
432432 int width, int height, int depth)
433433 }
434434 declare 106 generic {
435 int Tk_GetRelief(Tcl_Interp *interp, CONST char *name, int *reliefPtr)
435 int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr)
436436 }
437437 declare 107 generic {
438438 void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr)
443443 }
444444 declare 109 generic {
445445 int Tk_GetScreenMM(Tcl_Interp *interp,
446 Tk_Window tkwin, CONST char *str, double *doublePtr)
446 Tk_Window tkwin, const char *str, double *doublePtr)
447447 }
448448 declare 110 generic {
449449 int Tk_GetSelection(Tcl_Interp *interp,
451451 Tk_GetSelProc *proc, ClientData clientData)
452452 }
453453 declare 111 generic {
454 Tk_Uid Tk_GetUid(CONST char *str)
454 Tk_Uid Tk_GetUid(const char *str)
455455 }
456456 declare 112 generic {
457457 Visual * Tk_GetVisual(Tcl_Interp *interp,
458 Tk_Window tkwin, CONST char *str, int *depthPtr,
458 Tk_Window tkwin, const char *str, int *depthPtr,
459459 Colormap *colormapPtr)
460460 }
461461 declare 113 generic {
479479 int Tk_Init(Tcl_Interp *interp)
480480 }
481481 declare 119 generic {
482 Atom Tk_InternAtom(Tk_Window tkwin, CONST char *name)
482 Atom Tk_InternAtom(Tk_Window tkwin, const char *name)
483483 }
484484 declare 120 generic {
485485 int Tk_IntersectTextLayout(Tk_TextLayout layout, int x, int y,
497497 }
498498 declare 124 generic {
499499 void Tk_ManageGeometry(Tk_Window tkwin,
500 CONST Tk_GeomMgr *mgrPtr, ClientData clientData)
500 const Tk_GeomMgr *mgrPtr, ClientData clientData)
501501 }
502502 declare 125 generic {
503503 void Tk_MapWindow(Tk_Window tkwin)
504504 }
505505 declare 126 generic {
506506 int Tk_MeasureChars(Tk_Font tkfont,
507 CONST char *source, int numBytes, int maxPixels,
507 const char *source, int numBytes, int maxPixels,
508508 int flags, int *lengthPtr)
509509 }
510510 declare 127 generic {
552552 }
553553 declare 141 generic {
554554 Tk_Window Tk_NameToWindow(Tcl_Interp *interp,
555 CONST char *pathName, Tk_Window tkwin)
555 const char *pathName, Tk_Window tkwin)
556556 }
557557 declare 142 generic {
558558 void Tk_OwnSelection(Tk_Window tkwin,
562562 declare 143 generic {
563563 int Tk_ParseArgv(Tcl_Interp *interp,
564564 Tk_Window tkwin, int *argcPtr, CONST84 char **argv,
565 Tk_ArgvInfo *argTable, int flags)
565 const Tk_ArgvInfo *argTable, int flags)
566566 }
567567 declare 144 generic {
568568 void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle,
621621 int Tk_SafeInit(Tcl_Interp *interp)
622622 }
623623 declare 160 generic {
624 CONST char * Tk_SetAppName(Tk_Window tkwin, CONST char *name)
624 const char * Tk_SetAppName(Tk_Window tkwin, const char *name)
625625 }
626626 declare 161 generic {
627627 void Tk_SetBackgroundFromBorder(Tk_Window tkwin, Tk_3DBorder border)
628628 }
629629 declare 162 generic {
630 void Tk_SetClass(Tk_Window tkwin, CONST char *className)
630 void Tk_SetClass(Tk_Window tkwin, const char *className)
631631 }
632632 declare 163 generic {
633633 void Tk_SetGrid(Tk_Window tkwin, int reqWidth, int reqHeight,
672672 void Tk_TextLayoutToPostscript(Tcl_Interp *interp, Tk_TextLayout layout)
673673 }
674674 declare 176 generic {
675 int Tk_TextWidth(Tk_Font font, CONST char *str, int numBytes)
675 int Tk_TextWidth(Tk_Font font, const char *str, int numBytes)
676676 }
677677 declare 177 generic {
678678 void Tk_UndefineCursor(Tk_Window window)
680680 declare 178 generic {
681681 void Tk_UnderlineChars(Display *display,
682682 Drawable drawable, GC gc, Tk_Font tkfont,
683 CONST char *source, int x, int y, int firstByte,
683 const char *source, int x, int y, int firstByte,
684684 int lastByte)
685685 }
686686 declare 179 generic {
729729 }
730730 declare 190 generic {
731731 Tk_OptionTable Tk_CreateOptionTable(Tcl_Interp *interp,
732 CONST Tk_OptionSpec *templatePtr)
732 const Tk_OptionSpec *templatePtr)
733733 }
734734 declare 191 generic {
735735 void Tk_DeleteOptionTable(Tk_OptionTable optionTable)
800800 }
801801 declare 210 generic {
802802 int Tk_GetScrollInfoObj(Tcl_Interp *interp,
803 int objc, Tcl_Obj *CONST objv[], double *dblPtr, int *intPtr)
803 int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr)
804804 }
805805 declare 211 generic {
806806 int Tk_InitOptions(Tcl_Interp *interp, char *recordPtr,
816816 declare 214 generic {
817817 int Tk_SetOptions(Tcl_Interp *interp, char *recordPtr,
818818 Tk_OptionTable optionTable, int objc,
819 Tcl_Obj *CONST objv[], Tk_Window tkwin,
819 Tcl_Obj *const objv[], Tk_Window tkwin,
820820 Tk_SavedOptions *savePtr, int *maskPtr)
821821 }
822822 declare 215 generic {
826826 int Tk_CreateConsoleWindow(Tcl_Interp *interp)
827827 }
828828 declare 217 generic {
829 void Tk_CreateSmoothMethod(Tcl_Interp *interp, Tk_SmoothMethod *method)
829 void Tk_CreateSmoothMethod(Tcl_Interp *interp, const Tk_SmoothMethod *method)
830830 }
831831
832832 #declare 218 generic {
834834 #}
835835
836836 #declare 219 generic {
837 # VOID *Tk_GetCanvasVisitor(Tcl_Interp *interp, CONST char *name)
837 # VOID *Tk_GetCanvasVisitor(Tcl_Interp *interp, const char *name)
838838 #}
839839
840840 declare 220 generic {
841 int Tk_GetDash(Tcl_Interp *interp, CONST char *value, Tk_Dash *dash)
841 int Tk_GetDash(Tcl_Interp *interp, const char *value, Tk_Dash *dash)
842842 }
843843 declare 221 generic {
844844 void Tk_CreateOutline(Tk_Outline *outline)
924924 #
925925 declare 241 generic {
926926 Tk_Window Tk_CreateAnonymousWindow(Tcl_Interp *interp,
927 Tk_Window parent, CONST char *screenName)
927 Tk_Window parent, const char *screenName)
928928 }
929929 declare 242 generic {
930930 void Tk_SetClassProcs(Tk_Window tkwin,
964964
965965 # Style engine
966966 declare 249 generic {
967 Tk_StyleEngine Tk_RegisterStyleEngine(CONST char *name,
967 Tk_StyleEngine Tk_RegisterStyleEngine(const char *name,
968968 Tk_StyleEngine parent)
969969 }
970970 declare 250 generic {
971 Tk_StyleEngine Tk_GetStyleEngine(CONST char *name)
971 Tk_StyleEngine Tk_GetStyleEngine(const char *name)
972972 }
973973 declare 251 generic {
974974 int Tk_RegisterStyledElement(Tk_StyleEngine engine,
975975 Tk_ElementSpec *templatePtr)
976976 }
977977 declare 252 generic {
978 int Tk_GetElementId(CONST char *name)
978 int Tk_GetElementId(const char *name)
979979 }
980980 declare 253 generic {
981 Tk_Style Tk_CreateStyle(CONST char *name, Tk_StyleEngine engine,
981 Tk_Style Tk_CreateStyle(const char *name, Tk_StyleEngine engine,
982982 ClientData clientData)
983983 }
984984 declare 254 generic {
985 Tk_Style Tk_GetStyle(Tcl_Interp *interp, CONST char *name)
985 Tk_Style Tk_GetStyle(Tcl_Interp *interp, const char *name)
986986 }
987987 declare 255 generic {
988988 void Tk_FreeStyle(Tk_Style style)
989989 }
990990 declare 256 generic {
991 CONST char * Tk_NameOfStyle(Tk_Style style)
991 const char * Tk_NameOfStyle(Tk_Style style)
992992 }
993993 declare 257 generic {
994994 Tk_Style Tk_AllocStyleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
10671067 # Developers who need to produce a file [load]able into legacy interps must
10681068 # build against legacy sources.
10691069 declare 272 generic {
1070 void Tk_CreateOldImageType(Tk_ImageType *typePtr)
1070 void Tk_CreateOldImageType(const Tk_ImageType *typePtr)
10711071 }
10721072 declare 273 generic {
1073 void Tk_CreateOldPhotoImageFormat(Tk_PhotoImageFormat *formatPtr)
1073 void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr)
10741074 }
10751075
10761076 # Define the platform specific public Tk interface. These functions are
11531153 # Public functions that are not accessible via the stubs table.
11541154
11551155 export {
1156 CONST char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, CONST char *version,
1156 const char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, const char *version,
11571157 int exact)
11581158 }
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tk.h,v 1.117 2008/09/03 06:01:51 dgp Exp $
14 * RCS: @(#) $Id: tk.h,v 1.127 2008/12/19 14:32:25 dgp Exp $
1515 */
1616
1717 #ifndef _TK
5151
5252 #define TK_MAJOR_VERSION 8
5353 #define TK_MINOR_VERSION 6
54 #define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE
55 #define TK_RELEASE_SERIAL 3
54 #define TK_RELEASE_LEVEL TCL_BETA_RELEASE
55 #define TK_RELEASE_SERIAL 1
5656
5757 #define TK_VERSION "8.6"
58 #define TK_PATCH_LEVEL "8.6a3"
58 #define TK_PATCH_LEVEL "8.6b1"
5959
6060 /*
6161 * A special definition used to allow this header file to be included from
8585 # undef TCL_STORAGE_CLASS
8686 # define TCL_STORAGE_CLASS DLLEXPORT
8787 #endif
88
89 /*
88
89 /*
90 *----------------------------------------------------------------------
91 *
9092 * Decide whether or not to use input methods.
9193 */
9294
121123 typedef const char *Tk_Uid;
122124
123125 /*
126 *----------------------------------------------------------------------
127 *
124128 * The enum below defines the valid types for Tk configuration options as
125129 * implemented by Tk_InitOptions, Tk_SetOptions, etc.
126130 */
311315
312316 typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp,
313317 Tk_Window tkwin, CONST84 char *value, char *widgRec, int offset);
314 typedef char *(Tk_OptionPrintProc) (ClientData clientData, Tk_Window tkwin,
318 typedef CONST86 char *(Tk_OptionPrintProc) (ClientData clientData, Tk_Window tkwin,
315319 char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
316320
317321 typedef struct Tk_CustomOption {
337341 int type; /* Type of option, such as TK_CONFIG_COLOR;
338342 * see definitions below. Last option in table
339343 * must have type TK_CONFIG_END. */
340 char *argvName; /* Switch used to specify option in argv. NULL
344 const char *argvName; /* Switch used to specify option in argv. NULL
341345 * means this spec is part of a group. */
342346 Tk_Uid dbName; /* Name for option in option database. */
343347 Tk_Uid dbClass; /* Class for option in database. */
349353 int specFlags; /* Any combination of the values defined
350354 * below; other bits are used internally by
351355 * tkConfig.c. */
352 Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is a
356 CONST86 Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is a
353357 * pointer to info about how to parse and
354358 * print the option. Otherwise it is
355359 * irrelevant. */
397401 */
398402
399403 typedef struct {
400 char *key; /* The key string that flags the option in the
404 const char *key; /* The key string that flags the option in the
401405 * argv array. */
402406 int type; /* Indicates option type; see below. */
403407 char *src; /* Value to be used in setting dst; usage
404408 * depends on type. */
405409 char *dst; /* Address of value to be modified; usage
406410 * depends on type. */
407 char *help; /* Documentation message describing this
411 const char *help; /* Documentation message describing this
408412 * option. */
409413 } Tk_ArgvInfo;
410414
614618 #define TK_SCROLL_ERROR 4
615619
616620 /*
617 *---------------------------------------------------------------------------
621 *----------------------------------------------------------------------
618622 *
619623 * Extensions to the X event set
620624 *
621 *---------------------------------------------------------------------------
625 *----------------------------------------------------------------------
622626 */
623627
624628 #define VirtualEvent (MappingNotify + 1)
675679 } XActivateDeactivateEvent;
676680 typedef XActivateDeactivateEvent XActivateEvent;
677681 typedef XActivateDeactivateEvent XDeactivateEvent;
678
679 /*
680 *--------------------------------------------------------------
682
683 /*
684 *----------------------------------------------------------------------
681685 *
682686 * Macros for querying Tk_Window structures. See the manual entries for
683687 * documentation.
684688 *
685 *--------------------------------------------------------------
689 *----------------------------------------------------------------------
686690 */
687691
688692 #define Tk_Display(tkwin) (((Tk_FakeWin *) (tkwin))->display)
716720 (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED)
717721 #define Tk_TopWinHierarchy(tkwin) \
718722 (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY)
723 #define Tk_IsManageable(tkwin) \
724 (((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE)
719725 #define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth)
720726 #define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight)
721727 /* Tk_InternalBorderWidth is deprecated */
851857 * TK_PROP_PROPCHANGE 1 means that PropertyNotify events in the
852858 * window's children should propagate up to this
853859 * window.
860 * TK_WM_MANAGEABLE 1 marks a window as capable of being converted
861 * into a toplevel using [wm manage].
854862 */
855863
856864 #define TK_MAPPED 1
872880 #define TK_WIN_MANAGED 0x10000
873881 #define TK_TOP_HIERARCHY 0x20000
874882 #define TK_PROP_PROPCHANGE 0x40000
875
876 /*
877 *--------------------------------------------------------------
883 #define TK_WM_MANAGEABLE 0x80000
884
885 /*
886 *----------------------------------------------------------------------
878887 *
879888 * Procedure prototypes and structures used for defining new canvas items:
880889 *
881 *--------------------------------------------------------------
890 *----------------------------------------------------------------------
882891 */
883892
884893 typedef enum {
887896 } Tk_State;
888897
889898 typedef struct Tk_SmoothMethod {
890 char *name;
899 const char *name;
891900 int (*coordProc) (Tk_Canvas canvas, double *pointPtr, int numPoints,
892901 int numSteps, XPoint xPoints[], double dblPoints[]);
893902 void (*postscriptProc) (Tcl_Interp *interp, Tk_Canvas canvas,
960969 */
961970
962971 #ifdef USE_OLD_CANVAS
963 typedef int Tk_ItemCreateProc (Tcl_Interp *interp, Tk_Canvas canvas,
972 typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas,
964973 Tk_Item *itemPtr, int argc, char **argv);
965 typedef int Tk_ItemConfigureProc (Tcl_Interp *interp, Tk_Canvas canvas,
974 typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
966975 Tk_Item *itemPtr, int argc, char **argv, int flags);
967 typedef int Tk_ItemCoordProc (Tcl_Interp *interp, Tk_Canvas canvas,
976 typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
968977 Tk_Item *itemPtr, int argc, char **argv);
969978 #else
970 typedef int Tk_ItemCreateProc (Tcl_Interp *interp, Tk_Canvas canvas,
979 typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas,
971980 Tk_Item *itemPtr, int argc, Tcl_Obj *const objv[]);
972 typedef int Tk_ItemConfigureProc (Tcl_Interp *interp, Tk_Canvas canvas,
981 typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
973982 Tk_Item *itemPtr, int argc, Tcl_Obj *const objv[],
974983 int flags);
975 typedef int Tk_ItemCoordProc (Tcl_Interp *interp, Tk_Canvas canvas,
984 typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
976985 Tk_Item *itemPtr, int argc, Tcl_Obj *const argv[]);
977986 #endif
978 typedef void Tk_ItemDeleteProc (Tk_Canvas canvas, Tk_Item *itemPtr,
987 typedef void (Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
979988 Display *display);
980 typedef void Tk_ItemDisplayProc (Tk_Canvas canvas, Tk_Item *itemPtr,
989 typedef void (Tk_ItemDisplayProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
981990 Display *display, Drawable dst, int x, int y, int width,
982991 int height);
983 typedef double Tk_ItemPointProc (Tk_Canvas canvas, Tk_Item *itemPtr,
992 typedef double (Tk_ItemPointProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
984993 double *pointPtr);
985 typedef int Tk_ItemAreaProc (Tk_Canvas canvas, Tk_Item *itemPtr,
994 typedef int (Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
986995 double *rectPtr);
987 typedef int Tk_ItemPostscriptProc (Tcl_Interp *interp, Tk_Canvas canvas,
996 typedef int (Tk_ItemPostscriptProc)(Tcl_Interp *interp, Tk_Canvas canvas,
988997 Tk_Item *itemPtr, int prepass);
989 typedef void Tk_ItemScaleProc (Tk_Canvas canvas, Tk_Item *itemPtr,
998 typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
990999 double originX, double originY, double scaleX,
9911000 double scaleY);
992 typedef void Tk_ItemTranslateProc (Tk_Canvas canvas, Tk_Item *itemPtr,
1001 typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
9931002 double deltaX, double deltaY);
994 typedef int Tk_ItemIndexProc (Tcl_Interp *interp, Tk_Canvas canvas,
1003 typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
9951004 Tk_Item *itemPtr, char *indexString, int *indexPtr);
996 typedef void Tk_ItemCursorProc (Tk_Canvas canvas, Tk_Item *itemPtr,
1005 typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
9971006 int index);
998 typedef int Tk_ItemSelectionProc (Tk_Canvas canvas, Tk_Item *itemPtr,
1007 typedef int (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
9991008 int offset, char *buffer, int maxBytes);
1000 typedef void Tk_ItemInsertProc (Tk_Canvas canvas, Tk_Item *itemPtr,
1009 typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
10011010 int beforeThis, char *string);
1002 typedef void Tk_ItemDCharsProc (Tk_Canvas canvas, Tk_Item *itemPtr,
1011 typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
10031012 int first, int last);
10041013
10051014 #ifndef __NO_OLD_CONFIG
10061015
10071016 typedef struct Tk_ItemType {
1008 char *name; /* The name of this type of item, such as
1017 const char *name; /* The name of this type of item, such as
10091018 * "line". */
10101019 int itemSize; /* Total amount of space needed for item's
10111020 * record. */
10611070 char *reserved4;
10621071 } Tk_ItemType;
10631072
1073 /*
1074 * Flag (used in the alwaysRedraw field) to say whether an item supports
1075 * point-level manipulation like the line and polygon items.
1076 */
1077
1078 #define TK_MOVABLE_POINTS 2
1079
10641080 #endif
10651081
10661082 /*
11061122 * should be displayed in focusItemPtr.
11071123 * Read-only to items.*/
11081124 } Tk_CanvasTextInfo;
1109
1125
11101126 /*
11111127 * Structures used for Dashing and Outline.
11121128 */
11471163 Tk_Dash dash; /* Dash pattern. */
11481164 Tk_Dash activeDash; /* Dash pattern if state is active. */
11491165 Tk_Dash disabledDash; /* Dash pattern if state is disabled. */
1150 VOID *reserved1; /* Reserved for future expansion. */
1151 VOID *reserved2;
1152 VOID *reserved3;
1166 void *reserved1; /* Reserved for future expansion. */
1167 void *reserved2;
1168 void *reserved3;
11531169 Tk_TSOffset tsoffset; /* Stipple offset for outline. */
11541170 XColor *color; /* Outline color. */
11551171 XColor *activeColor; /* Outline color if state is active. */
11601176 Pixmap disabledStipple; /* Outline Stipple pattern if state is
11611177 * disabled. */
11621178 } Tk_Outline;
1163
1164 /*
1165 *--------------------------------------------------------------
1179
1180 /*
1181 *----------------------------------------------------------------------
11661182 *
11671183 * Procedure prototypes and structures used for managing images:
11681184 *
1169 *--------------------------------------------------------------
1185 *----------------------------------------------------------------------
11701186 */
11711187
11721188 typedef struct Tk_ImageType Tk_ImageType;
11751191 char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master,
11761192 ClientData *masterDataPtr);
11771193 #else
1178 typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int objc,
1179 Tcl_Obj *const objv[], Tk_ImageType *typePtr, Tk_ImageMaster master,
1194 typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc,
1195 Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster master,
11801196 ClientData *masterDataPtr);
11811197 #endif
11821198 typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData);
12001216 */
12011217
12021218 struct Tk_ImageType {
1203 char *name; /* Name of image type. */
1219 const char *name; /* Name of image type. */
12041220 Tk_ImageCreateProc *createProc;
12051221 /* Procedure to call to create a new image of
12061222 * this type. */
12261242 * manager. */
12271243 char *reserved; /* reserved for future expansion */
12281244 };
1229
1230 /*
1231 *--------------------------------------------------------------
1245
1246 /*
1247 *----------------------------------------------------------------------
12321248 *
12331249 * Additional definitions used to manage images of type "photo".
12341250 *
1235 *--------------------------------------------------------------
1251 *----------------------------------------------------------------------
12361252 */
12371253
12381254 /*
13121328 */
13131329
13141330 struct Tk_PhotoImageFormat {
1315 char *name; /* Name of image file format */
1331 const char *name; /* Name of image file format */
13161332 Tk_ImageFileMatchProc *fileMatchProc;
13171333 /* Procedure to call to determine whether an
13181334 * image file matches this format. */
13421358 #define Tk_CreateImageType Tk_CreateOldImageType
13431359 #define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat
13441360 #endif
1345
1346 /*
1347 *--------------------------------------------------------------
1361
1362 /*
1363 *----------------------------------------------------------------------
13481364 *
13491365 * Procedure prototypes and structures used for managing styles:
13501366 *
1351 *--------------------------------------------------------------
1367 *----------------------------------------------------------------------
13521368 */
13531369
13541370 /*
14101426 #define TK_ELEMENT_STATE_DISABLED 1<<1
14111427 #define TK_ELEMENT_STATE_FOCUS 1<<2
14121428 #define TK_ELEMENT_STATE_PRESSED 1<<3
1413
1414 /*
1415 *--------------------------------------------------------------
1429
1430 /*
1431 *----------------------------------------------------------------------
14161432 *
14171433 * The definitions below provide backward compatibility for functions and
14181434 * types related to event handling that used to be in Tk but have moved to
14191435 * Tcl.
14201436 *
1421 *--------------------------------------------------------------
1437 *----------------------------------------------------------------------
14221438 */
14231439
14241440 #define TK_READABLE TCL_READABLE
14731489
14741490 #define Tk_InitImageArgs(interp, argc, argv) /**/
14751491
1476
1477 /*
1478 *--------------------------------------------------------------
1492
1493 /*
1494 *----------------------------------------------------------------------
14791495 *
14801496 * Additional procedure types defined by Tk.
14811497 *
1482 *--------------------------------------------------------------
1498 *----------------------------------------------------------------------
14831499 */
14841500
14851501 typedef int (Tk_ErrorProc) (ClientData clientData, XErrorEvent *errEventPtr);
14871503 typedef int (Tk_GenericProc) (ClientData clientData, XEvent *eventPtr);
14881504 typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr);
14891505 typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp,
1490 char *portion);
1506 CONST86 char *portion);
14911507 typedef void (Tk_LostSelProc) (ClientData clientData);
14921508 typedef Tk_RestrictAction (Tk_RestrictProc) (ClientData clientData,
14931509 XEvent *eventPtr);
14941510 typedef int (Tk_SelectionProc) (ClientData clientData, int offset,
14951511 char *buffer, int maxBytes);
1496
1497 /*
1498 *--------------------------------------------------------------
1499 *
1500 * Platform independant exported procedures and variables.
1501 *
1502 *--------------------------------------------------------------
1512
1513 /*
1514 *----------------------------------------------------------------------
1515 *
1516 * Platform independent exported procedures and variables.
1517 *
1518 *----------------------------------------------------------------------
15031519 */
15041520
15051521 #include "tkDecls.h"
15061522
15071523 /*
1524 *----------------------------------------------------------------------
1525 *
15081526 * Allow users to say that they don't want to alter their source to add extra
15091527 * arguments to Tk_PhotoPutBlock() et al; DO NOT DEFINE THIS WHEN BUILDING TK.
15101528 *
15441562 # endif
15451563 # define Tk_PhotoSetSize Tk_PhotoSetSize_Panic
15461564 #endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */
1547
1548 /*
1549 * Tcl commands exported by Tk:
1550 */
1551
1565
15521566 #undef TCL_STORAGE_CLASS
15531567 #define TCL_STORAGE_CLASS DLLIMPORT
15541568
15631577 #endif
15641578
15651579 #endif /* _TK */
1566
1580
15671581 /*
15681582 * Local Variables:
15691583 * mode: c
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tk3d.c,v 1.20 2008/04/27 22:38:55 dkf Exp $
12 * RCS: @(#) $Id: tk3d.c,v 1.24 2008/12/12 00:09:37 nijtmans Exp $
1313 */
1414
1515 #include "tkInt.h"
2020 * by Tk_GetReliefFromObj.
2121 */
2222
23 static const char *reliefStrings[] = {
23 static const char *const reliefStrings[] = {
2424 "flat", "groove", "raised", "ridge", "solid", "sunken", NULL
2525 };
2626
4646 * is set.
4747 */
4848
49 Tcl_ObjType tkBorderObjType = {
49 const Tcl_ObjType tkBorderObjType = {
5050 "border", /* name */
5151 FreeBorderObjProc, /* freeIntRepProc */
5252 DupBorderObjProc, /* dupIntRepProc */
9090 if (objPtr->typePtr != &tkBorderObjType) {
9191 InitBorderObj(objPtr);
9292 }
93 borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1;
93 borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
9494
9595 /*
9696 * If the object currently points to a TkBorder, see if it's the one we
129129 */
130130
131131 if (borderPtr != NULL) {
132 TkBorder *firstBorderPtr =
133 (TkBorder *) Tcl_GetHashValue(borderPtr->hashPtr);
132 TkBorder *firstBorderPtr = Tcl_GetHashValue(borderPtr->hashPtr);
133
134134 FreeBorderObjProc(objPtr);
135135 for (borderPtr = firstBorderPtr ; borderPtr != NULL;
136136 borderPtr = borderPtr->nextPtr) {
137137 if ((Tk_Screen(tkwin) == borderPtr->screen)
138 && (Tk_Colormap(tkwin) == borderPtr->colormap)) {
138 && (Tk_Colormap(tkwin) == borderPtr->colormap)) {
139139 borderPtr->resourceRefCount++;
140140 borderPtr->objRefCount++;
141 objPtr->internalRep.twoPtrValue.ptr1 = (void *) borderPtr;
141 objPtr->internalRep.twoPtrValue.ptr1 = borderPtr;
142142 return (Tk_3DBorder) borderPtr;
143143 }
144144 }
150150
151151 borderPtr = (TkBorder *) Tk_Get3DBorder(interp, tkwin,
152152 Tcl_GetString(objPtr));
153 objPtr->internalRep.twoPtrValue.ptr1 = (void *) borderPtr;
153 objPtr->internalRep.twoPtrValue.ptr1 = borderPtr;
154154 if (borderPtr != NULL) {
155155 borderPtr->objRefCount++;
156156 }
202202
203203 hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &isNew);
204204 if (!isNew) {
205 existingBorderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr);
205 existingBorderPtr = Tcl_GetHashValue(hashPtr);
206206 for (borderPtr = existingBorderPtr; borderPtr != NULL;
207207 borderPtr = borderPtr->nextPtr) {
208208 if ((Tk_Screen(tkwin) == borderPtr->screen)
427427 return;
428428 }
429429
430 prevPtr = (TkBorder *) Tcl_GetHashValue(borderPtr->hashPtr);
430 prevPtr = Tcl_GetHashValue(borderPtr->hashPtr);
431431 TkpFreeBorder(borderPtr);
432432 if (borderPtr->bgColorPtr != NULL) {
433433 Tk_FreeColor(borderPtr->bgColorPtr);
521521 FreeBorderObjProc(
522522 Tcl_Obj *objPtr) /* The object we are releasing. */
523523 {
524 TkBorder *borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1;
524 TkBorder *borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
525525
526526 if (borderPtr != NULL) {
527527 borderPtr->objRefCount--;
556556 Tcl_Obj *srcObjPtr, /* The object we are copying from. */
557557 Tcl_Obj *dupObjPtr) /* The object we are copying to. */
558558 {
559 TkBorder *borderPtr = (TkBorder *) srcObjPtr->internalRep.twoPtrValue.ptr1;
559 TkBorder *borderPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
560560
561561 dupObjPtr->typePtr = srcObjPtr->typePtr;
562 dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) borderPtr;
562 dupObjPtr->internalRep.twoPtrValue.ptr1 = borderPtr;
563563
564564 if (borderPtr != NULL) {
565565 borderPtr->objRefCount++;
669669 } else {
670670 char buf[200];
671671
672 sprintf(buf, "bad relief type \"%.50s\": must be %s",
672 sprintf(buf, "bad relief \"%.50s\": must be %s",
673673 name, "flat, groove, raised, ridge, solid, or sunken");
674674 Tcl_SetResult(interp, buf, TCL_VOLATILE);
675675 return TCL_ERROR;
981981 if ((width > doubleBorder) && (height > doubleBorder)) {
982982 XFillRectangle(Tk_Display(tkwin), drawable, borderPtr->bgGC,
983983 x + borderWidth, y + borderWidth,
984 (unsigned int) (width - doubleBorder),
985 (unsigned int) (height - doubleBorder));
984 (unsigned) (width - doubleBorder),
985 (unsigned) (height - doubleBorder));
986986 }
987987 if (borderWidth) {
988988 Tk_Draw3DRectangle(tkwin, drawable, border, x, y, width,
12501250 * cached in the internal representation of the Tcl_Obj. Check it out...
12511251 */
12521252
1253 borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1;
1253 borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
12541254 if ((borderPtr != NULL)
12551255 && (borderPtr->resourceRefCount > 0)
12561256 && (Tk_Screen(tkwin) == borderPtr->screen)
12781278 if (hashPtr == NULL) {
12791279 goto error;
12801280 }
1281 for (borderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr);
1282 (borderPtr != NULL); borderPtr = borderPtr->nextPtr) {
1281 for (borderPtr = Tcl_GetHashValue(hashPtr); borderPtr != NULL;
1282 borderPtr = borderPtr->nextPtr) {
12831283 if ((Tk_Screen(tkwin) == borderPtr->screen)
12841284 && (Tk_Colormap(tkwin) == borderPtr->colormap)) {
12851285 FreeBorderObjProc(objPtr);
1286 objPtr->internalRep.twoPtrValue.ptr1 = (void *) borderPtr;
1286 objPtr->internalRep.twoPtrValue.ptr1 = borderPtr;
12871287 borderPtr->objRefCount++;
12881288 return (Tk_3DBorder) borderPtr;
12891289 }
13301330 Tcl_GetString(objPtr);
13311331 typePtr = objPtr->typePtr;
13321332 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
1333 (*typePtr->freeIntRepProc)(objPtr);
1333 typePtr->freeIntRepProc(objPtr);
13341334 }
13351335 objPtr->typePtr = &tkBorderObjType;
13361336 objPtr->internalRep.twoPtrValue.ptr1 = NULL;
13611361 * (not currently used). */
13621362 char *name) /* Name of the desired color. */
13631363 {
1364 TkBorder *borderPtr;
13651364 Tcl_HashEntry *hashPtr;
1366 Tcl_Obj *resultPtr, *objPtr;
1365 Tcl_Obj *resultPtr;
13671366 TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
13681367
13691368 resultPtr = Tcl_NewObj();
13701369 hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, name);
13711370 if (hashPtr != NULL) {
1372 borderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr);
1371 TkBorder *borderPtr = Tcl_GetHashValue(hashPtr);
1372
13731373 if (borderPtr == NULL) {
13741374 Tcl_Panic("TkDebugBorder found empty hash table entry");
13751375 }
13761376 for ( ; (borderPtr != NULL); borderPtr = borderPtr->nextPtr) {
1377 objPtr = Tcl_NewObj();
1377 Tcl_Obj *objPtr = Tcl_NewObj();
1378
13781379 Tcl_ListObjAppendElement(NULL, objPtr,
13791380 Tcl_NewIntObj(borderPtr->resourceRefCount));
13801381 Tcl_ListObjAppendElement(NULL, objPtr,
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkArgv.c,v 1.15 2008/10/03 13:13:31 dkf Exp $
12 * RCS: @(#) $Id: tkArgv.c,v 1.17 2008/11/08 18:44:39 dkf Exp $
1313 */
1414
1515 #include "tkInt.h"
2929 * Forward declarations for functions defined in this file:
3030 */
3131
32 static void PrintUsage(Tcl_Interp *interp, Tk_ArgvInfo *argTable,
32 static void PrintUsage(Tcl_Interp *interp, const Tk_ArgvInfo *argTable,
3333 int flags);
3434
3535 /*
6464 * hold # args left in argv at end. */
6565 const char **argv, /* Array of arguments. Modified to hold those
6666 * that couldn't be processed here. */
67 Tk_ArgvInfo *argTable, /* Array of option descriptions */
67 const Tk_ArgvInfo *argTable, /* Array of option descriptions */
6868 int flags) /* Or'ed combination of various flag bits,
6969 * such as TK_ARGV_NO_DEFAULTS. */
7070 {
71 register Tk_ArgvInfo *infoPtr;
71 register const Tk_ArgvInfo *infoPtr;
7272 /* Pointer to the current entry in the table
7373 * of argument descriptions. */
74 Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */
74 const Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */
7575 const char *curArg; /* Current argument */
7676 register char c; /* Second character of current arg (used for
7777 * quick check for matching; use 2nd char.
227227 }
228228 break;
229229 case TK_ARGV_FUNC: {
230 typedef int (ArgvFunc)(char *, char *, const char *);
230 typedef int (ArgvFunc)(char *, const char *, const char *);
231231 ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src;
232232
233 if ((*handlerProc)(infoPtr->dst, infoPtr->key, argv[srcIndex])) {
233 if (handlerProc(infoPtr->dst, infoPtr->key, argv[srcIndex])) {
234234 srcIndex++;
235235 argc--;
236236 }
237237 break;
238238 }
239239 case TK_ARGV_GENFUNC: {
240 typedef int (ArgvGenFunc)(char *, Tcl_Interp *, char *, int,
240 typedef int (ArgvGenFunc)(char *, Tcl_Interp *, const char *, int,
241241 const char **);
242242 ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src;
243243
244 argc = (*handlerProc)(infoPtr->dst, interp, infoPtr->key,
245 argc, argv+srcIndex);
244 argc = handlerProc(infoPtr->dst, interp, infoPtr->key, argc,
245 argv+srcIndex);
246246 if (argc < 0) {
247247 return TCL_ERROR;
248248 }
329329 PrintUsage(
330330 Tcl_Interp *interp, /* Place information in this interp's result
331331 * area. */
332 Tk_ArgvInfo *argTable, /* Array of command-specific argument
332 const Tk_ArgvInfo *argTable, /* Array of command-specific argument
333333 * descriptions. */
334334 int flags) /* If the TK_ARGV_NO_DEFAULTS bit is set in
335335 * this word, then don't generate information
336336 * for default options. */
337337 {
338 register Tk_ArgvInfo *infoPtr;
338 register const Tk_ArgvInfo *infoPtr;
339339 size_t width, i, numSpaces;
340340 char tmp[TCL_DOUBLE_SPACE];
341341
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkAtom.c,v 1.8 2008/04/27 22:38:55 dkf Exp $
14 * RCS: @(#) $Id: tkAtom.c,v 1.11 2008/10/30 23:18:59 nijtmans Exp $
1515 */
1616
1717 #include "tkInt.h"
2121 * those found in xatom.h
2222 */
2323
24 static char * atomNameArray[] = {
24 static const char *const atomNameArray[] = {
2525 "PRIMARY", "SECONDARY", "ARC",
2626 "ATOM", "BITMAP", "CARDINAL",
2727 "COLORMAP", "CURSOR", "CUT_BUFFER0",
7979 * window's display. */
8080 const char *name) /* Name to turn into atom. */
8181 {
82 register TkDisplay *dispPtr;
83 register Tcl_HashEntry *hPtr;
82 TkDisplay *dispPtr;
83 Tcl_HashEntry *hPtr;
8484 int isNew;
8585
8686 dispPtr = ((TkWindow *) tkwin)->dispPtr;
128128 * this window's display. */
129129 Atom atom) /* Atom whose name is wanted. */
130130 {
131 register TkDisplay *dispPtr;
132 register Tcl_HashEntry *hPtr;
131 TkDisplay *dispPtr;
132 Tcl_HashEntry *hPtr;
133133
134134 dispPtr = ((TkWindow *) tkwin)->dispPtr;
135135 if (!dispPtr->atomInit) {
138138
139139 hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom);
140140 if (hPtr == NULL) {
141 char *name;
141 const char *name;
142142 Tk_ErrorHandler handler;
143 int isNew, mustFree;
143 int isNew;
144 char *mustFree = NULL;
144145
145146 handler = Tk_CreateErrorHandler(dispPtr->display, BadAtom, -1, -1,
146147 NULL, (ClientData) NULL);
147 name = XGetAtomName(dispPtr->display, atom);
148 mustFree = 1;
148 name = mustFree = XGetAtomName(dispPtr->display, atom);
149149 if (name == NULL) {
150150 name = "?bad atom?";
151 mustFree = 0;
152151 }
153152 Tk_DeleteErrorHandler(handler);
154153 hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
155154 Tcl_SetHashValue(hPtr, atom);
156155 if (mustFree) {
157 XFree(name);
156 XFree(mustFree);
158157 }
159158 name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
160159 hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom, &isNew);
181180
182181 static void
183182 AtomInit(
184 register TkDisplay *dispPtr)/* Display to initialize. */
183 TkDisplay *dispPtr)/* Display to initialize. */
185184 {
186185 Tcl_HashEntry *hPtr;
187186 Atom atom;
191190 Tcl_InitHashTable(&dispPtr->atomTable, TCL_ONE_WORD_KEYS);
192191
193192 for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) {
194 char *name;
193 const char *name;
195194 int isNew;
196195
197196 hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom);
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkBind.c,v 1.46 2008/07/23 23:24:23 nijtmans Exp $
13 * RCS: @(#) $Id: tkBind.c,v 1.51 2008/12/09 21:22:56 dgp Exp $
1414 */
1515
1616 #include "tkInt.h"
3030 *
3131 * Init/Free this package.
3232 *
33 * Tcl "bind" command (actually located in tkCmds.c).
34 * "bind" command implementation.
35 * "bind" implementation helpers.
36 *
37 * Tcl "event" command.
38 * "event" command implementation.
39 * "event" implementation helpers.
33 * Tcl "bind" command (actually located in tkCmds.c) core implementation, plus
34 * helpers.
35 *
36 * Tcl "event" command implementation, plus helpers.
4037 *
4138 * Package-specific common helpers.
4239 *
229226 * enough space will be allocated for
230227 * "numPats" patterns. To match, pats[0] must
231228 * match event n, pats[1] must match event
232 * n-1, etc.
233 */
229 * n-1, etc. */
234230 } PatSeq;
235231
236232 /*
354350
355351 #ifdef REDO_KEYSYM_LOOKUP
356352 typedef struct {
357 char *name; /* Name of keysym. */
353 const char *name; /* Name of keysym. */
358354 KeySym value; /* Numeric identifier for keysym. */
359355 } KeySymInfo;
360356 static KeySymInfo keyArray[] = {
383379 */
384380
385381 typedef struct {
386 char *name; /* Name of modifier. */
382 const char *name; /* Name of modifier. */
387383 int mask; /* Button/modifier mask value, such as
388384 * Button1Mask. */
389385 int flags; /* Various flags; see below for
407403 #define QUADRUPLE 4
408404 #define MULT_CLICKS 7
409405
410 static ModInfo modArray[] = {
406 static const ModInfo modArray[] = {
411407 {"Control", ControlMask, 0},
412408 {"Shift", ShiftMask, 0},
413409 {"Lock", LockMask, 0},
452448 */
453449
454450 typedef struct {
455 char *name; /* Name of event. */
451 const char *name; /* Name of event. */
456452 int type; /* Event type for X, such as ButtonPress. */
457453 int eventMask; /* Mask bits (for XSelectInput) for this event
458454 * type. */
535531 #define CIRCREQ 0x400000
536532
537533 #define KEY_BUTTON_MOTION_VIRTUAL (KEY|BUTTON|MOTION|VIRTUAL)
538 #define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|CROSSING|VIRTUAL)
534 #define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|VIRTUAL|CROSSING)
539535
540536 static int flagArray[TK_LASTEVENT] = {
541537 /* Not used */ 0,
673669 static char * GetField(char *p, char *copy, int size);
674670 static void GetPatternString(PatSeq *psPtr, Tcl_DString *dsPtr);
675671 static int GetVirtualEvent(Tcl_Interp *interp,
676 VirtualEventTable *vetPtr, char *virtString);
672 VirtualEventTable *vetPtr, Tcl_Obj *virtName);
677673 static Tk_Uid GetVirtualEventUid(Tcl_Interp *interp,
678674 char *virtString);
679675 static int HandleEventGenerate(Tcl_Interp *interp, Tk_Window main,
698694 */
699695
700696 #define EvalTclBinding ((TkBindEvalProc *) 1)
701
702697
703698 /*
704699 *---------------------------------------------------------------------------
737732 Tcl_MutexLock(&bindMutex);
738733 if (!initialized) {
739734 Tcl_HashEntry *hPtr;
740 ModInfo *modPtr;
735 const ModInfo *modPtr;
741736 EventInfo *eiPtr;
742737 int newEntry;
743
744738 #ifdef REDO_KEYSYM_LOOKUP
745739 KeySymInfo *kPtr;
746740
816810 bindInfoPtr = (BindInfo *) mainPtr->bindInfo;
817811 DeleteVirtualEventTable(&bindInfoPtr->virtualEventTable);
818812 bindInfoPtr->deleted = 1;
819 Tcl_EventuallyFree((ClientData) bindInfoPtr, TCL_DYNAMIC);
813 Tcl_EventuallyFree(bindInfoPtr, TCL_DYNAMIC);
820814 mainPtr->bindInfo = NULL;
821815 }
822816
895889
896890 for (hPtr = Tcl_FirstHashEntry(&bindPtr->patternTable, &search);
897891 hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
898 for (psPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
899 psPtr != NULL; psPtr = nextPtr) {
892 for (psPtr = Tcl_GetHashValue(hPtr); psPtr != NULL; psPtr = nextPtr) {
900893 nextPtr = psPtr->nextSeqPtr;
901894 psPtr->flags |= MARKED_DELETED;
902895 if (psPtr->refCount == 0) {
903896 if (psPtr->freeProc != NULL) {
904 (*psPtr->freeProc)(psPtr->clientData);
897 psPtr->freeProc(psPtr->clientData);
905898 }
906899 ckfree((char *) psPtr);
907900 }
984977 if (isNew) {
985978 psPtr->nextObjPtr = NULL;
986979 } else {
987 psPtr->nextObjPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
980 psPtr->nextObjPtr = Tcl_GetHashValue(hPtr);
988981 }
989982 Tcl_SetHashValue(hPtr, psPtr);
990983 } else if (psPtr->eventProc != EvalTclBinding) {
993986 */
994987
995988 if (psPtr->freeProc != NULL) {
996 (*psPtr->freeProc)(psPtr->clientData);
989 psPtr->freeProc(psPtr->clientData);
997990 }
998991 psPtr->clientData = NULL;
999992 append = 0;
1000993 }
1001994
1002 oldStr = (char *) psPtr->clientData;
995 oldStr = psPtr->clientData;
1003996 if ((append != 0) && (oldStr != NULL)) {
1004 size_t length;
1005
1006 length = strlen(oldStr) + strlen(command) + 2;
1007 newStr = (char *) ckalloc((unsigned) length);
1008 sprintf(newStr, "%s\n%s", oldStr, command);
997 size_t length1 = strlen(oldStr), length2 = strlen(command);
998
999 newStr = ckalloc((unsigned) length1 + length2 + 2);
1000 memcpy(newStr, oldStr, length1);
1001 newStr[length1] = '\n';
1002 memcpy(newStr+length1+1, command, length2+1);
10091003 } else {
1010 newStr = (char *) ckalloc((unsigned) strlen(command) + 1);
1011 strcpy(newStr, command);
1004 size_t length = strlen(command);
1005
1006 newStr = ckalloc((unsigned) length+1);
1007 memcpy(newStr, command, length+1);
10121008 }
10131009 if (oldStr != NULL) {
10141010 ckfree(oldStr);
10151011 }
10161012 psPtr->eventProc = EvalTclBinding;
10171013 psPtr->freeProc = FreeTclBinding;
1018 psPtr->clientData = (ClientData) newStr;
1014 psPtr->clientData = newStr;
10191015 return eventMask;
10201016 }
10211017
10821078 if (isNew) {
10831079 psPtr->nextObjPtr = NULL;
10841080 } else {
1085 psPtr->nextObjPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
1081 psPtr->nextObjPtr = Tcl_GetHashValue(hPtr);
10861082 }
10871083 Tcl_SetHashValue(hPtr, psPtr);
10881084 } else {
1089
10901085 /*
10911086 * Free existing callback.
10921087 */
10931088
10941089 if (psPtr->freeProc != NULL) {
1095 (*psPtr->freeProc)(psPtr->clientData);
1090 psPtr->freeProc(psPtr->clientData);
10961091 }
10971092 }
10981093
11511146 if (hPtr == NULL) {
11521147 Tcl_Panic("Tk_DeleteBinding couldn't find object table entry");
11531148 }
1154 prevPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
1149 prevPtr = Tcl_GetHashValue(hPtr);
11551150 if (prevPtr == psPtr) {
11561151 Tcl_SetHashValue(hPtr, psPtr->nextObjPtr);
11571152 } else {
11651160 }
11661161 }
11671162 }
1168 prevPtr = (PatSeq *) Tcl_GetHashValue(psPtr->hPtr);
1163 prevPtr = Tcl_GetHashValue(psPtr->hPtr);
11691164 if (prevPtr == psPtr) {
11701165 if (psPtr->nextSeqPtr == NULL) {
11711166 Tcl_DeleteHashEntry(psPtr->hPtr);
11871182 psPtr->flags |= MARKED_DELETED;
11881183 if (psPtr->refCount == 0) {
11891184 if (psPtr->freeProc != NULL) {
1190 (*psPtr->freeProc)(psPtr->clientData);
1185 psPtr->freeProc(psPtr->clientData);
11911186 }
11921187 ckfree((char *) psPtr);
11931188 }
12771272 return;
12781273 }
12791274 Tcl_DStringInit(&ds);
1280 for (psPtr = (PatSeq *) Tcl_GetHashValue(hPtr); psPtr != NULL;
1275 for (psPtr = Tcl_GetHashValue(hPtr); psPtr != NULL;
12811276 psPtr = psPtr->nextObjPtr) {
12821277 /*
12831278 * For each binding, output information about each of the patterns in
13231318 if (hPtr == NULL) {
13241319 return;
13251320 }
1326 for (psPtr = (PatSeq *) Tcl_GetHashValue(hPtr); psPtr != NULL;
1321 for (psPtr = Tcl_GetHashValue(hPtr); psPtr != NULL;
13271322 psPtr = nextPtr) {
1328 nextPtr = psPtr->nextObjPtr;
1323 nextPtr = psPtr->nextObjPtr;
13291324
13301325 /*
13311326 * Be sure to remove each binding from its hash chain in the pattern
13331328 * hash entry too.
13341329 */
13351330
1336 prevPtr = (PatSeq *) Tcl_GetHashValue(psPtr->hPtr);
1331 prevPtr = Tcl_GetHashValue(psPtr->hPtr);
13371332 if (prevPtr == psPtr) {
13381333 if (psPtr->nextSeqPtr == NULL) {
13391334 Tcl_DeleteHashEntry(psPtr->hPtr);
13551350
13561351 if (psPtr->refCount == 0) {
13571352 if (psPtr->freeProc != NULL) {
1358 (*psPtr->freeProc)(psPtr->clientData);
1353 psPtr->freeProc(psPtr->clientData);
13591354 }
13601355 ckfree((char *) psPtr);
13611356 }
14201415 Tcl_DString scripts, savedResult;
14211416 Detail detail;
14221417 char *p, *end;
1423 PendingBinding *pendingPtr;
1424 PendingBinding staticPending;
1425 TkWindow *winPtr = (TkWindow *)tkwin;
1418 PendingBinding staticPending, *pendingPtr;
1419 TkWindow *winPtr = (TkWindow *) tkwin;
14261420 PatternTableKey key;
14271421 Tk_ClassModalProc *modalProc;
14281422
14441438 * mega-widget isn't supposed to be visible to people watching the parent.
14451439 */
14461440
1447 if ((eventPtr->type == EnterNotify) || (eventPtr->type == LeaveNotify)) {
1441 if ((eventPtr->type == EnterNotify) || (eventPtr->type == LeaveNotify)) {
14481442 if (eventPtr->xcrossing.detail == NotifyInferior) {
14491443 return;
14501444 }
14511445 }
1452 if ((eventPtr->type == FocusIn) || (eventPtr->type == FocusOut)) {
1446 if ((eventPtr->type == FocusIn) || (eventPtr->type == FocusOut)) {
14531447 if (eventPtr->xfocus.detail == NotifyInferior) {
14541448 return;
14551449 }
15171511 }
15181512 }
15191513 ringPtr = &bindPtr->eventRing[bindPtr->curEvent];
1520 memcpy((void *) ringPtr, (void *) eventPtr, sizeof(XEvent));
1514 memcpy(ringPtr, eventPtr, sizeof(XEvent));
15211515 detail.clientData = 0;
15221516 flags = flagArray[ringPtr->type];
15231517 if (flags & KEY) {
15421536 memset(&key, 0, sizeof(key));
15431537
15441538 if (ringPtr->type != VirtualEvent) {
1545 Tcl_HashTable *veptPtr;
1539 Tcl_HashTable *veptPtr = &bindInfoPtr->virtualEventTable.patternTable;
15461540 Tcl_HashEntry *hPtr;
1547
1548 veptPtr = &bindInfoPtr->virtualEventTable.patternTable;
15491541
15501542 key.object = NULL;
15511543 key.type = ringPtr->type;
15531545
15541546 hPtr = Tcl_FindHashEntry(veptPtr, (char *) &key);
15551547 if (hPtr != NULL) {
1556 vMatchDetailList = (PatSeq *) Tcl_GetHashValue(hPtr);
1548 vMatchDetailList = Tcl_GetHashValue(hPtr);
15571549 }
15581550
15591551 if (key.detail.clientData != 0) {
15601552 key.detail.clientData = 0;
15611553 hPtr = Tcl_FindHashEntry(veptPtr, (char *) &key);
15621554 if (hPtr != NULL) {
1563 vMatchNoDetailList = (PatSeq *) Tcl_GetHashValue(hPtr);
1555 vMatchNoDetailList = Tcl_GetHashValue(hPtr);
15641556 }
15651557 }
15661558 }
15791571 Tcl_DStringInit(&scripts);
15801572
15811573 for ( ; numObjects > 0; numObjects--, objectPtr++) {
1582 PatSeq *matchPtr, *sourcePtr;
1574 PatSeq *matchPtr = NULL, *sourcePtr = NULL;
15831575 Tcl_HashEntry *hPtr;
1584
1585 matchPtr = NULL;
1586 sourcePtr = NULL;
15871576
15881577 /*
15891578 * Match the new event against those recorded in the pattern table,
15981587 key.detail = detail;
15991588 hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key);
16001589 if (hPtr != NULL) {
1601 matchPtr = MatchPatterns(dispPtr, bindPtr,
1602 (PatSeq *) Tcl_GetHashValue(hPtr), matchPtr, NULL,
1603 &sourcePtr);
1590 matchPtr = MatchPatterns(dispPtr, bindPtr, Tcl_GetHashValue(hPtr),
1591 matchPtr, NULL, &sourcePtr);
16041592 }
16051593
16061594 if (vMatchDetailList != NULL) {
16181606 hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key);
16191607 if (hPtr != NULL) {
16201608 matchPtr = MatchPatterns(dispPtr, bindPtr,
1621 (PatSeq *) Tcl_GetHashValue(hPtr), matchPtr, NULL,
1622 &sourcePtr);
1609 Tcl_GetHashValue(hPtr), matchPtr, NULL, &sourcePtr);
16231610 }
16241611
16251612 if (vMatchNoDetailList != NULL) {
16491636 - sizeof(staticPending.matchArray)
16501637 + matchSpace * sizeof(PatSeq*);
16511638 newPtr = (PendingBinding *) ckalloc(newSize);
1652 memcpy((void *) newPtr, (void *) pendingPtr, oldSize);
1639 memcpy(newPtr, pendingPtr, oldSize);
16531640 if (pendingPtr != &staticPending) {
16541641 ckfree((char *) pendingPtr);
16551642 }
17401727 * can tell that by first checking to see if winPtr->mainPtr == NULL.
17411728 */
17421729
1743 Tcl_Preserve((ClientData) bindInfoPtr);
1730 Tcl_Preserve(bindInfoPtr);
17441731 while (p < end) {
17451732 int code;
17461733
17571744 code = TCL_OK;
17581745 if ((pendingPtr->deleted == 0)
17591746 && ((psPtr->flags & MARKED_DELETED) == 0)) {
1760 code = (*psPtr->eventProc)(psPtr->clientData, interp, eventPtr,
1747 code = psPtr->eventProc(psPtr->clientData, interp, eventPtr,
17611748 tkwin, detail.keySym);
17621749 }
17631750 psPtr->refCount--;
17641751 if ((psPtr->refCount == 0) && (psPtr->flags & MARKED_DELETED)) {
17651752 if (psPtr->freeProc != NULL) {
1766 (*psPtr->freeProc)(psPtr->clientData);
1753 psPtr->freeProc(psPtr->clientData);
17671754 }
17681755 ckfree((char *) psPtr);
17691756 }
17701757 } else {
17711758 int len = (int) strlen(p);
1759
17721760 code = Tcl_EvalEx(interp, p, len, TCL_EVAL_GLOBAL);
17731761 p += len;
17741762 }
17861774 break;
17871775 } else {
17881776 Tcl_AddErrorInfo(interp, "\n (command bound to event)");
1789 Tcl_BackgroundError(interp);
1777 Tcl_BackgroundException(interp, code);
17901778 break;
17911779 }
17921780 }
18041792 if (deferModal) {
18051793 modalProc = Tk_GetClassProc(winPtr->classProcsPtr, modalProc);
18061794 if (modalProc != NULL) {
1807 (*modalProc)(tkwin, eventPtr);
1795 modalProc(tkwin, eventPtr);
18081796 }
18091797 }
18101798 }
18451833 ckfree((char *) pendingPtr);
18461834 }
18471835 }
1848 Tcl_Release((ClientData) bindInfoPtr);
1836 Tcl_Release(bindInfoPtr);
18491837 }
18501838
18511839 /*
19271915 *
19281916 *----------------------------------------------------------------------
19291917 */
1918
19301919 static PatSeq *
19311920 MatchPatterns(
19321921 TkDisplay *dispPtr, /* Display from which the event came. */
19611950 */
19621951
19631952 for ( ; psPtr != NULL; psPtr = psPtr->nextSeqPtr) {
1964 XEvent *eventPtr;
1965 Pattern *patPtr;
1966 Window window;
1967 Detail *detailPtr;
1968 int patCount, ringCount, flags, state;
1969 int modMask;
1953 XEvent *eventPtr = &bindPtr->eventRing[bindPtr->curEvent];
1954 Detail *detailPtr = &bindPtr->detailRing[bindPtr->curEvent];
1955 Pattern *patPtr = psPtr->pats;
1956 Window window = eventPtr->xany.window;
1957 int patCount, ringCount, flags, state, modMask, i;
19701958
19711959 /*
19721960 * Iterate over all the patterns in a sequence to be sure that they
19731961 * all match.
19741962 */
19751963
1976 eventPtr = &bindPtr->eventRing[bindPtr->curEvent];
1977 detailPtr = &bindPtr->detailRing[bindPtr->curEvent];
1978 window = eventPtr->xany.window;
1979 patPtr = psPtr->pats;
19801964 patCount = psPtr->numPats;
19811965 ringCount = EVENT_BUFFER_SIZE;
19821966 while (patCount > 0) {
20121996 || (patPtr->eventType == ButtonRelease)) {
20131997 if ((eventPtr->xany.type == KeyPress)
20141998 || (eventPtr->xany.type == KeyRelease)) {
2015 int i;
2016
20171999 /*
20182000 * Ignore key events if they are modifier keys.
20192001 */
20242006 /*
20252007 * This key is a modifier key, so ignore it.
20262008 */
2009
20272010 goto nextEvent;
20282011 }
20292012 }
20552038 */
20562039
20572040 if (eventPtr->xany.type == KeyPress) {
2058 int i;
2059
20602041 for (i = 0; i < dispPtr->numModKeyCodes; i++) {
20612042 if (dispPtr->modKeyCodes[i] == eventPtr->xkey.keycode) {
20622043 goto nextEvent;
20662047 goto nextSequence;
20672048 }
20682049 flags = flagArray[eventPtr->type];
2069 if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
2050 if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
20702051 state = eventPtr->xkey.state;
20712052 } else if (flags & CROSSING) {
20722053 state = eventPtr->xcrossing.state;
20942075 }
20952076 }
20962077 if (psPtr->flags & PAT_NEARBY) {
2097 XEvent *firstPtr;
2078 XEvent *firstPtr = &bindPtr->eventRing[bindPtr->curEvent];
20982079 int timeDiff;
20992080
2100 firstPtr = &bindPtr->eventRing[bindPtr->curEvent];
21012081 timeDiff = (Time) firstPtr->xkey.time - eventPtr->xkey.time;
21022082 if ((firstPtr->xkey.x_root
21032083 < (eventPtr->xkey.x_root - NEARBY_PIXELS))
21532133 hPtr = Tcl_FindHashEntry(&bindPtr->patternTable,
21542134 (char *) &key);
21552135 if (hPtr != NULL) {
2156
21572136 /*
21582137 * This tag is interested in this virtual event and its
21592138 * corresponding physical event is a good match with the
21602139 * virtual event's definition.
21612140 */
21622141
2163 PatSeq *virtMatchPtr;
2164
2165 virtMatchPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
2142 PatSeq *virtMatchPtr = Tcl_GetHashValue(hPtr);
2143
21662144 if ((virtMatchPtr->numPats != 1)
21672145 || (virtMatchPtr->nextSeqPtr != NULL)) {
21682146 Tcl_Panic("MatchPattern: badly constructed virtual event");
21892167
21902168 if (bestPtr != NULL) {
21912169 Pattern *patPtr2;
2192 int i;
21932170
21942171 if (matchPtr->numPats != bestPtr->numPats) {
21952172 if (bestPtr->numPats > matchPtr->numPats) {
22172194 }
22182195 }
22192196 }
2197
22202198 /*
22212199 * Tie goes to current best pattern.
22222200 *
22472225 *sourcePtrPtr = bestSourcePtr;
22482226 return bestPtr;
22492227 }
2250
22512228
22522229 /*
22532230 *--------------------------------------------------------------
23752352 case 'h':
23762353 if (flags & EXPOSE) {
23772354 number = eventPtr->xexpose.height;
2378 } else if (flags & (CONFIG)) {
2355 } else if (flags & CONFIG) {
23792356 number = eventPtr->xconfigure.height;
23802357 } else if (flags & CREATE) {
23812358 number = eventPtr->xcreatewindow.height;
23822359 } else if (flags & CONFIGREQ) {
2383 number = eventPtr->xconfigurerequest.height;
2360 number = eventPtr->xconfigurerequest.height;
23842361 } else if (flags & RESIZEREQ) {
2385 number = eventPtr->xresizerequest.height;
2362 number = eventPtr->xresizerequest.height;
23862363 } else {
23872364 goto doString;
23882365 }
24382415 }
24392416 goto doString;
24402417 case 's':
2441 if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
2418 if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
24422419 number = eventPtr->xkey.state;
2420 goto doNumber;
24432421 } else if (flags & CROSSING) {
24442422 number = eventPtr->xcrossing.state;
2423 goto doNumber;
24452424 } else if (flags & PROP) {
24462425 string = TkFindStateString(propNotify,
24472426 eventPtr->xproperty.state);
24532432 } else {
24542433 goto doString;
24552434 }
2456 goto doNumber;
24572435 case 't':
2458 if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
2436 if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
24592437 number = (int) eventPtr->xkey.time;
24602438 } else if (flags & CROSSING) {
24612439 number = (int) eventPtr->xcrossing.time;
24762454 } else if (flags & CREATE) {
24772455 number = eventPtr->xcreatewindow.width;
24782456 } else if (flags & CONFIGREQ) {
2479 number = eventPtr->xconfigurerequest.width;
2457 number = eventPtr->xconfigurerequest.width;
24802458 } else if (flags & RESIZEREQ) {
2481 number = eventPtr->xresizerequest.width;
2459 number = eventPtr->xresizerequest.width;
24822460 } else {
24832461 goto doString;
24842462 }
24852463 goto doNumber;
24862464 case 'x':
2487 if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
2465 if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
24882466 number = eventPtr->xkey.x;
24892467 } else if (flags & CROSSING) {
24902468 number = eventPtr->xcrossing.x;
24972475 } else if (flags & CREATE) {
24982476 number = eventPtr->xcreatewindow.x;
24992477 } else if (flags & CONFIGREQ) {
2500 number = eventPtr->xconfigurerequest.x;
2478 number = eventPtr->xconfigurerequest.x;
25012479 } else {
25022480 goto doString;
25032481 }
25042482 goto doNumber;
25052483 case 'y':
2506 if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
2484 if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
25072485 number = eventPtr->xkey.y;
25082486 } else if (flags & EXPOSE) {
25092487 number = eventPtr->xexpose.y;
25532531 goto doNumber;
25542532 case 'K':
25552533 if (flags & KEY) {
2556 char *name;
2557
2558 name = TkKeysymToString(keySym);
2534 char *name = TkKeysymToString(keySym);
2535
25592536 if (name != NULL) {
25602537 string = name;
25612538 }
26622639 * ChangeScreen --
26632640 *
26642641 * This function is invoked whenever the current screen changes in an
2665 * application. It invokes a Tcl function named "tk::ScreenChanged",
2642 * application. It invokes a Tcl command named "tk::ScreenChanged",
26662643 * passing it the screen name as argument. tk::ScreenChanged does things
26672644 * like making the tk::Priv variable point to an array for the current
26682645 * display.
26712648 * None.
26722649 *
26732650 * Side effects:
2674 * Depends on what tk::ScreenChanged does. If an error occurs them
2651 * Depends on what tk::ScreenChanged does. If an error occurs then
26752652 * bgerror will be invoked.
26762653 *
26772654 *----------------------------------------------------------------------
26832660 char *dispName, /* Name of new display. */
26842661 int screenIndex) /* Index of new screen. */
26852662 {
2686 Tcl_DString cmd;
2663 Tcl_Obj *cmdObj = Tcl_ObjPrintf("::tk::ScreenChanged %s.%d",
2664 dispName, screenIndex);
26872665 int code;
2688 char screen[TCL_INTEGER_SPACE];
2689
2690 Tcl_DStringInit(&cmd);
2691 Tcl_DStringAppend(&cmd, "tk::ScreenChanged ", 18);
2692 Tcl_DStringAppend(&cmd, dispName, -1);
2693 sprintf(screen, ".%d", screenIndex);
2694 Tcl_DStringAppend(&cmd, screen, -1);
2695 code = Tcl_EvalEx(interp, Tcl_DStringValue(&cmd), Tcl_DStringLength(&cmd),
2696 TCL_EVAL_GLOBAL);
2697 Tcl_DStringFree(&cmd);
2666
2667 Tcl_IncrRefCount(cmdObj);
2668 code = Tcl_GlobalEvalObj(interp, cmdObj);
26982669 if (code != TCL_OK) {
26992670 Tcl_AddErrorInfo(interp,
27002671 "\n (changing screen in event binding)");
2701 Tcl_BackgroundError(interp);
2702 }
2672 Tcl_BackgroundException(interp, code);
2673 }
2674 Tcl_DecrRefCount(cmdObj);
27032675 }
27042676
27052677 /*
27262698 int objc, /* Number of arguments. */
27272699 Tcl_Obj *const objv[]) /* Argument objects. */
27282700 {
2729 int index;
2730 Tk_Window tkwin;
2701 int index, i;
2702 char *name, *event;
2703 Tk_Window tkwin = clientData;
27312704 VirtualEventTable *vetPtr;
27322705 TkBindInfo bindInfo;
2733 static const char *optionStrings[] = {
2706 static const char *const optionStrings[] = {
27342707 "add", "delete", "generate", "info",
27352708 NULL
27362709 };
27382711 EVENT_ADD, EVENT_DELETE, EVENT_GENERATE, EVENT_INFO
27392712 };
27402713
2741 tkwin = (Tk_Window) clientData;
27422714 bindInfo = ((TkWindow *) tkwin)->mainPtr->bindInfo;
27432715 vetPtr = &((BindInfo *) bindInfo)->virtualEventTable;
27442716
27522724 }
27532725
27542726 switch ((enum options) index) {
2755 case EVENT_ADD: {
2756 int i;
2757 char *name, *event;
2758
2727 case EVENT_ADD:
27592728 if (objc < 4) {
27602729 Tcl_WrongNumArgs(interp, 2, objv,
27612730 "virtual sequence ?sequence ...?");
27692738 }
27702739 }
27712740 break;
2772 }
2773 case EVENT_DELETE: {
2774 int i;
2775 char *name, *event;
2776
2741 case EVENT_DELETE:
27772742 if (objc < 3) {
2778 Tcl_WrongNumArgs(interp, 2, objv,
2779 "virtual ?sequence ...?");
2743 Tcl_WrongNumArgs(interp, 2, objv, "virtual ?sequence ...?");
27802744 return TCL_ERROR;
27812745 }
27822746 name = Tcl_GetString(objv[2]);
27902754 }
27912755 }
27922756 break;
2793 }
27942757 case EVENT_GENERATE:
27952758 if (objc < 4) {
2796 Tcl_WrongNumArgs(interp, 2, objv, "window event ?-option value ...?");
2759 Tcl_WrongNumArgs(interp, 2, objv,
2760 "window event ?-option value ...?");
27972761 return TCL_ERROR;
27982762 }
27992763 return HandleEventGenerate(interp, tkwin, objc - 2, objv + 2);
28022766 GetAllVirtualEvents(interp, vetPtr);
28032767 return TCL_OK;
28042768 } else if (objc == 3) {
2805 return GetVirtualEvent(interp, vetPtr, Tcl_GetString(objv[2]));
2769 return GetVirtualEvent(interp, vetPtr, objv[2]);
28062770 } else {
28072771 Tcl_WrongNumArgs(interp, 2, objv, "?virtual?");
28082772 return TCL_ERROR;
28652829
28662830 hPtr = Tcl_FirstHashEntry(&vetPtr->patternTable, &search);
28672831 for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
2868 psPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
2832 psPtr = Tcl_GetHashValue(hPtr);
28692833 for ( ; psPtr != NULL; psPtr = nextPtr) {
28702834 nextPtr = psPtr->nextSeqPtr;
28712835 ckfree((char *) psPtr->voPtr);
28762840
28772841 hPtr = Tcl_FirstHashEntry(&vetPtr->nameTable, &search);
28782842 for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
2879 ckfree((char *) Tcl_GetHashValue(hPtr));
2843 ckfree(Tcl_GetHashValue(hPtr));
28802844 }
28812845 Tcl_DeleteHashTable(&vetPtr->nameTable);
28822846 }
29422906 * Make virtual event own the physical event.
29432907 */
29442908
2945 poPtr = (PhysicalsOwned *) Tcl_GetHashValue(vhPtr);
2909 poPtr = Tcl_GetHashValue(vhPtr);
29462910 if (poPtr == NULL) {
29472911 poPtr = (PhysicalsOwned *) ckalloc(sizeof(PhysicalsOwned));
29482912 poPtr->numOwned = 0;
29622926 poPtr = (PhysicalsOwned *) ckrealloc((char *) poPtr,
29632927 sizeof(PhysicalsOwned) + poPtr->numOwned * sizeof(PatSeq *));
29642928 }
2965 Tcl_SetHashValue(vhPtr, (ClientData) poPtr);
2929 Tcl_SetHashValue(vhPtr, poPtr);
29662930 poPtr->patSeqs[poPtr->numOwned] = psPtr;
29672931 poPtr->numOwned++;
29682932
30342998 if (vhPtr == NULL) {
30352999 return TCL_OK;
30363000 }
3037 poPtr = (PhysicalsOwned *) Tcl_GetHashValue(vhPtr);
3001 poPtr = Tcl_GetHashValue(vhPtr);
30383002
30393003 eventPSPtr = NULL;
30403004 if (eventString != NULL) {
30493013 eventPSPtr = FindSequence(interp, &vetPtr->patternTable, NULL,
30503014 eventString, 0, 0, &eventMask);
30513015 if (eventPSPtr == NULL) {
3052 const char *string;
3053
3054 string = Tcl_GetStringResult(interp);
3016 const char *string = Tcl_GetStringResult(interp);
3017
30553018 return (string[0] != '\0') ? TCL_ERROR : TCL_OK;
30563019 }
30573020 }
30583021
30593022 for (iPhys = poPtr->numOwned; --iPhys >= 0; ) {
30603023 PatSeq *psPtr = poPtr->patSeqs[iPhys];
3024
30613025 if ((eventPSPtr == NULL) || (psPtr == eventPSPtr)) {
30623026 int iVirt;
30633027 VirtualOwners *voPtr;
30833047 * from physical->virtual map.
30843048 */
30853049
3086 PatSeq *prevPtr = (PatSeq *) Tcl_GetHashValue(psPtr->hPtr);
3050 PatSeq *prevPtr = Tcl_GetHashValue(psPtr->hPtr);
30873051
30883052 if (prevPtr == psPtr) {
30893053 if (psPtr->nextSeqPtr == NULL) {
31733137 GetVirtualEvent(
31743138 Tcl_Interp *interp, /* Interpreter for reporting. */
31753139 VirtualEventTable *vetPtr, /* Table in which to look for event. */
3176 char *virtString) /* String describing virtual event. */
3140 Tcl_Obj *virtName) /* String describing virtual event. */
31773141 {
31783142 Tcl_HashEntry *vhPtr;
31793143 Tcl_DString ds;
31813145 PhysicalsOwned *poPtr;
31823146 Tk_Uid virtUid;
31833147
3184 virtUid = GetVirtualEventUid(interp, virtString);
3148 virtUid = GetVirtualEventUid(interp, Tcl_GetString(virtName));
31853149 if (virtUid == NULL) {
31863150 return TCL_ERROR;
31873151 }
31933157
31943158 Tcl_DStringInit(&ds);
31953159
3196 poPtr = (PhysicalsOwned *) Tcl_GetHashValue(vhPtr);
3160 poPtr = Tcl_GetHashValue(vhPtr);
31973161 for (iPhys = 0; iPhys < poPtr->numOwned; iPhys++) {
31983162 Tcl_DStringSetLength(&ds, 0);
31993163 GetPatternString(poPtr->patSeqs[iPhys], &ds);
32973261 TkWindow *mainPtr;
32983262 unsigned long eventMask;
32993263 Tcl_Obj *userDataObj;
3300 static const char *fieldStrings[] = {
3264
3265 static const char *const fieldStrings[] = {
33013266 "-when", "-above", "-borderwidth", "-button",
33023267 "-count", "-data", "-delta", "-detail",
33033268 "-focus", "-height",
33533318 return TCL_ERROR;
33543319 }
33553320
3356 memset((void *) &event, 0, sizeof(event));
3321 memset(&event, 0, sizeof(event));
33573322 event.xany.type = pat.eventType;
33583323 event.xany.serial = NextRequest(Tk_Display(tkwin));
33593324 event.xany.send_event = False;
33743339 Tk_DestroyWindow(tkwin);
33753340 return TCL_OK;
33763341 }
3377 if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
3342 if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
33783343 event.xkey.state = pat.needMods;
33793344 if ((flags & KEY) && (event.xany.type != MouseWheelEvent)) {
33803345 TkpSetKeycodeAndState(tkwin, pat.detail.keySym, &event);
33883353 event.xcreatewindow.window = event.xany.window;
33893354 }
33903355
3391 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3356 if (flags & KEY_BUTTON_MOTION_CROSSING) {
33923357 event.xkey.x_root = -1;
33933358 event.xkey.y_root = -1;
3359 }
3360
3361 if (event.xany.type == FocusIn || event.xany.type == FocusOut) {
3362 event.xany.send_event = GENERATED_FOCUS_EVENT_MAGIC;
33943363 }
33953364
33963365 /*
34303399 if (Tcl_GetBooleanFromObj(interp, valuePtr, &warp) != TCL_OK) {
34313400 return TCL_ERROR;
34323401 }
3433 if (!(flags & (KEY_BUTTON_MOTION_VIRTUAL))) {
3402 if (!(flags & KEY_BUTTON_MOTION_VIRTUAL)) {
34343403 goto badopt;
34353404 }
34363405 break;
36223591 if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
36233592 return TCL_ERROR;
36243593 }
3625 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3594 if (flags & KEY_BUTTON_MOTION_CROSSING) {
36263595 event.xkey.root = Tk_WindowId(tkwin2);
36273596 } else {
36283597 goto badopt;
36323601 if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
36333602 return TCL_ERROR;
36343603 }
3635 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3604 if (flags & KEY_BUTTON_MOTION_CROSSING) {
36363605 event.xkey.x_root = number;
36373606 } else {
36383607 goto badopt;
36423611 if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
36433612 return TCL_ERROR;
36443613 }
3645 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3614 if (flags & KEY_BUTTON_MOTION_CROSSING) {
36463615 event.xkey.y_root = number;
36473616 } else {
36483617 goto badopt;
36763645 event.xany.serial = number;
36773646 break;
36783647 case EVENT_STATE:
3679 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3648 if (flags & KEY_BUTTON_MOTION_CROSSING) {
36803649 if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
36813650 return TCL_ERROR;
36823651 }
3683 if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
3652 if (flags & KEY_BUTTON_MOTION_VIRTUAL) {
36843653 event.xkey.state = number;
36853654 } else {
36863655 event.xcrossing.state = number;
37003669 if (NameToWindow(interp, tkwin, valuePtr, &tkwin2) != TCL_OK) {
37013670 return TCL_ERROR;
37023671 }
3703 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3672 if (flags & KEY_BUTTON_MOTION_CROSSING) {
37043673 event.xkey.subwindow = Tk_WindowId(tkwin2);
37053674 } else {
37063675 goto badopt;
37103679 if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) {
37113680 return TCL_ERROR;
37123681 }
3713 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3682 if (flags & KEY_BUTTON_MOTION_CROSSING) {
37143683 event.xkey.time = (Time) number;
37153684 } else if (flags & PROP) {
37163685 event.xproperty.time = (Time) number;
37443713 if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
37453714 return TCL_ERROR;
37463715 }
3747 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3716 if (flags & KEY_BUTTON_MOTION_CROSSING) {
37483717 event.xkey.x = number;
37493718
37503719 /*
37713740 if (Tk_GetPixelsFromObj(interp,tkwin,valuePtr,&number) != TCL_OK) {
37723741 return TCL_ERROR;
37733742 }
3774 if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) {
3743 if (flags & KEY_BUTTON_MOTION_CROSSING) {
37753744 event.xkey.y = number;
37763745
37773746 /*
38323801 */
38333802
38343803 if ((warp != 0) && Tk_IsMapped(tkwin)) {
3835 TkDisplay *dispPtr;
3836 dispPtr = TkGetDisplay(event.xmotion.display);
3804 TkDisplay *dispPtr = TkGetDisplay(event.xmotion.display);
3805
38373806 if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) {
3838 Tcl_DoWhenIdle(DoWarp, (ClientData) dispPtr);
3807 Tcl_DoWhenIdle(DoWarp, dispPtr);
38393808 dispPtr->flags |= TK_DISPLAY_IN_WARP;
38403809 }
38413810 dispPtr->warpWindow = event.xany.window;
38533822 Tcl_Obj *objPtr, /* Contains name or id string of window. */
38543823 Tk_Window *tkwinPtr) /* Filled with token for window. */
38553824 {
3856 char *name;
3825 char *name = Tcl_GetString(objPtr);
38573826 Tk_Window tkwin;
3858 Window id;
3859
3860 name = Tcl_GetString(objPtr);
3827
38613828 if (name[0] == '.') {
38623829 tkwin = Tk_NameToWindow(interp, name, mainWin);
38633830 if (tkwin == NULL) {
38643831 return TCL_ERROR;
38653832 }
3866 *tkwinPtr = tkwin;
38673833 } else {
3834 Window id;
3835
38683836 /*
38693837 * Check for the winPtr being valid, even if it looks ok to
38703838 * TkpScanWindowId. [Bug #411307]
38713839 */
38723840
3873 if ((TkpScanWindowId(NULL, name, &id) != TCL_OK) ||
3874 ((*tkwinPtr = Tk_IdToWindow(Tk_Display(mainWin), id))
3875 == NULL)) {
3876 Tcl_AppendResult(interp, "bad window name/identifier \"",
3877 name, "\"", NULL);
3878 return TCL_ERROR;
3879 }
3880 }
3841 if (TkpScanWindowId(NULL, name, &id) != TCL_OK) {
3842 goto badWindow;
3843 }
3844 tkwin = Tk_IdToWindow(Tk_Display(mainWin), id);
3845 if (tkwin == NULL) {
3846 goto badWindow;
3847 }
3848 }
3849 *tkwinPtr = tkwin;
38813850 return TCL_OK;
3851
3852 badWindow:
3853 Tcl_AppendResult(interp, "bad window name/identifier \"",name,"\"", NULL);
3854 return TCL_ERROR;
38823855 }
38833856
38843857 /*
38963869 *
38973870 *-------------------------------------------------------------------------
38983871 */
3872
38993873 static void
39003874 DoWarp(
39013875 ClientData clientData)
39023876 {
3903 TkDisplay *dispPtr = (TkDisplay *) clientData;
3904
3905 XWarpPointer(dispPtr->display, (Window) None, (Window) dispPtr->warpWindow,
3906 0, 0, 0, 0, (int) dispPtr->warpX, (int) dispPtr->warpY);
3877 TkDisplay *dispPtr = clientData;
3878
3879 XWarpPointer(dispPtr->display, (Window) None,
3880 (Window) dispPtr->warpWindow, 0, 0, 0, 0,
3881 (int) dispPtr->warpX, (int) dispPtr->warpY);
39073882 XForceScreenSaver(dispPtr->display, ScreenSaverReset);
39083883 dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
39093884 }
40784053 hPtr = Tcl_CreateHashEntry(patternTablePtr, (char *) &key, &isNew);
40794054 sequenceSize = numPats*sizeof(Pattern);
40804055 if (!isNew) {
4081 for (psPtr = (PatSeq *) Tcl_GetHashValue(hPtr); psPtr != NULL;
4056 for (psPtr = Tcl_GetHashValue(hPtr); psPtr != NULL;
40824057 psPtr = psPtr->nextSeqPtr) {
40834058 if ((numPats == psPtr->numPats)
40844059 && ((flags & PAT_NEARBY) == (psPtr->flags & PAT_NEARBY))
4085 && (memcmp((char *) patPtr, (char *) psPtr->pats,
4086 sequenceSize) == 0)) {
4060 && (memcmp(patPtr, psPtr->pats, sequenceSize) == 0)) {
40874061 goto done;
40884062 }
40894063 }
41034077
41044078 return NULL;
41054079 }
4106 psPtr = (PatSeq *) ckalloc((unsigned) (sizeof(PatSeq)
4107 + (numPats-1)*sizeof(Pattern)));
4080 psPtr = (PatSeq *) ckalloc((unsigned)
4081 (sizeof(PatSeq) + (numPats-1)*sizeof(Pattern)));
41084082 psPtr->numPats = numPats;
41094083 psPtr->eventProc = NULL;
41104084 psPtr->freeProc = NULL;
41114085 psPtr->clientData = NULL;
41124086 psPtr->flags = flags;
41134087 psPtr->refCount = 0;
4114 psPtr->nextSeqPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
4088 psPtr->nextSeqPtr = Tcl_GetHashValue(hPtr);
41154089 psPtr->hPtr = hPtr;
41164090 psPtr->voPtr = NULL;
41174091 psPtr->nextObjPtr = NULL;
41184092 Tcl_SetHashValue(hPtr, psPtr);
41194093
4120 memcpy((void *) psPtr->pats, (void *) patPtr, sequenceSize);
4094 memcpy(psPtr->pats, patPtr, sequenceSize);
41214095
41224096 done:
41234097 *maskPtr = eventMask;
41894163 if (isprint(UCHAR(*p))) {
41904164 patPtr->detail.keySym = *p;
41914165 } else {
4192 char buf[64];
4193
4194 sprintf(buf, "bad ASCII character 0x%x", (unsigned char) *p);
4195 Tcl_SetResult(interp, buf, TCL_VOLATILE);
4166 Tcl_SetObjResult(interp, Tcl_ObjPrintf(
4167 "bad ASCII character 0x%x", UCHAR(*p)));
41964168 count = 0;
41974169 goto done;
41984170 }
42304202 */
42314203
42324204 char *field = p + 1;
4205
42334206 p = strchr(field, '>');
42344207 if (p == field) {
42354208 Tcl_SetResult(interp, "virtual event \"<<>>\" is badly formed",
42554228
42564229 while (1) {
42574230 ModInfo *modPtr;
4231
42584232 p = GetField(p, field, FIELD_SIZE);
42594233 if (*p == '>') {
42604234 /*
42694243 if (hPtr == NULL) {
42704244 break;
42714245 }
4272 modPtr = (ModInfo *) Tcl_GetHashValue(hPtr);
4246 modPtr = Tcl_GetHashValue(hPtr);
42734247 patPtr->needMods |= modPtr->mask;
4274 if (modPtr->flags & (MULT_CLICKS)) {
4248 if (modPtr->flags & MULT_CLICKS) {
42754249 int i = modPtr->flags & MULT_CLICKS;
4250
42764251 count = 2;
4277 while (i >>= 1) count++;
4252 while (i >>= 1) {
4253 count++;
4254 }
42784255 }
42794256 while ((*p == '-') || isspace(UCHAR(*p))) {
42804257 p++;
42844261 eventFlags = 0;
42854262 hPtr = Tcl_FindHashEntry(&eventTable, field);
42864263 if (hPtr != NULL) {
4287 EventInfo *eiPtr;
4288 eiPtr = (EventInfo *) Tcl_GetHashValue(hPtr);
4264 EventInfo *eiPtr = Tcl_GetHashValue(hPtr);
42894265
42904266 patPtr->eventType = eiPtr->type;
42914267 eventFlags = flagArray[eiPtr->type];
44284404 Pattern *patPtr;
44294405 char c, buffer[TCL_INTEGER_SPACE];
44304406 int patsLeft, needMods;
4431 ModInfo *modPtr;
4407 const ModInfo *modPtr;
44324408 EventInfo *eiPtr;
44334409
44344410 /*
44384414
44394415 for (patsLeft = psPtr->numPats, patPtr = &psPtr->pats[psPtr->numPats - 1];
44404416 patsLeft > 0; patsLeft--, patPtr--) {
4441
44424417 /*
44434418 * Check for simple case of an ASCII character.
44444419 */
44504425 && isprint(UCHAR(patPtr->detail.keySym))
44514426 && (patPtr->detail.keySym != '<')
44524427 && (patPtr->detail.keySym != ' ')) {
4453
44544428 c = (char) patPtr->detail.keySym;
44554429 Tcl_DStringAppend(dsPtr, &c, 1);
44564430 continue;
44744448 */
44754449
44764450 Tcl_DStringAppend(dsPtr, "<", 1);
4451
44774452 if ((psPtr->flags & PAT_NEARBY) && (patsLeft > 1)
4478 && (memcmp((char *) patPtr, (char *) (patPtr-1),
4479 sizeof(Pattern)) == 0)) {
4453 && (memcmp(patPtr, patPtr-1, sizeof(Pattern)) == 0)) {
44804454 patsLeft--;
44814455 patPtr--;
4482 if ((patsLeft > 1) && (memcmp((char *) patPtr,
4483 (char *) (patPtr-1), sizeof(Pattern)) == 0)) {
4456 if ((patsLeft > 1) &&
4457 (memcmp(patPtr, patPtr-1, sizeof(Pattern)) == 0)) {
44844458 patsLeft--;
44854459 patPtr--;
4486 if ((patsLeft > 1) && (memcmp((char *) patPtr,
4487 (char *) (patPtr-1), sizeof(Pattern)) == 0)) {
4488 patsLeft--;
4489 patPtr--;
4490 Tcl_DStringAppend(dsPtr, "Quadruple-", 10);
4491 } else {
4492 Tcl_DStringAppend(dsPtr, "Triple-", 7);
4493 }
4460 if ((patsLeft > 1) &&
4461 (memcmp(patPtr, patPtr-1, sizeof(Pattern)) == 0)) {
4462 patsLeft--;
4463 patPtr--;
4464 Tcl_DStringAppend(dsPtr, "Quadruple-", 10);
4465 } else {
4466 Tcl_DStringAppend(dsPtr, "Triple-", 7);
4467 }
44944468 } else {
44954469 Tcl_DStringAppend(dsPtr, "Double-", 7);
44964470 }
44974471 }
4472
44984473 for (needMods = patPtr->needMods, modPtr = modArray;
44994474 needMods != 0; modPtr++) {
45004475 if (modPtr->mask & needMods) {
45034478 Tcl_DStringAppend(dsPtr, "-", 1);
45044479 }
45054480 }
4481
45064482 for (eiPtr = eventArray; eiPtr->name != NULL; eiPtr++) {
45074483 if (eiPtr->type == patPtr->eventType) {
45084484 Tcl_DStringAppend(dsPtr, eiPtr->name, -1);
45164492 if (patPtr->detail.clientData != 0) {
45174493 if ((patPtr->eventType == KeyPress)
45184494 || (patPtr->eventType == KeyRelease)) {
4519 char *string;
4520
4521 string = TkKeysymToString(patPtr->detail.keySym);
4495 char *string = TkKeysymToString(patPtr->detail.keySym);
4496
45224497 if (string != NULL) {
45234498 Tcl_DStringAppend(dsPtr, string, -1);
45244499 }
45274502 Tcl_DStringAppend(dsPtr, buffer, -1);
45284503 }
45294504 }
4505
45304506 Tcl_DStringAppend(dsPtr, ">", 1);
45314507 }
45324508 }
45784554 char *name) /* Name of a keysym. */
45794555 {
45804556 #ifdef REDO_KEYSYM_LOOKUP
4581 Tcl_HashEntry *hPtr;
4582 KeySym keysym;
4583
4584 hPtr = Tcl_FindHashEntry(&keySymTable, name);
4557 Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&keySymTable, name);
4558
45854559 if (hPtr != NULL) {
45864560 return (KeySym) Tcl_GetHashValue(hPtr);
45874561 }
45884562 if (strlen(name) == 1) {
4589 keysym = (KeySym) (unsigned char) name[0];
4563 KeySym keysym = (KeySym) (unsigned char) name[0];
4564
45904565 if (TkKeysymToString(keysym) != NULL) {
45914566 return keysym;
45924567 }
46174592 KeySym keysym)
46184593 {
46194594 #ifdef REDO_KEYSYM_LOOKUP
4620 Tcl_HashEntry *hPtr;
4621
4622 hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym);
4595 Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym);
4596
46234597 if (hPtr != NULL) {
4624 return (char *) Tcl_GetHashValue(hPtr);
4598 return Tcl_GetHashValue(hPtr);
46254599 }
46264600 #endif /* REDO_KEYSYM_LOOKUP */
4601
46274602 return XKeysymToString(keysym);
46284603 }
46294604
46874662 {
46884663 TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp);
46894664 BindingTable *bindPtr = (BindingTable *) winPtr->mainPtr->bindingTable;
4665
46904666 return &(bindPtr->eventRing[bindPtr->curEvent]);
46914667 }
46924668
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkBitmap.c,v 1.21 2007/12/13 15:24:13 dgp Exp $
13 * RCS: @(#) $Id: tkBitmap.c,v 1.24 2008/11/08 18:44:39 dkf Exp $
1414 */
1515
1616 #include "tkInt.h"
121121 * field of the Tcl_Obj points to a TkBitmap object.
122122 */
123123
124 Tcl_ObjType tkBitmapObjType = {
124 const Tcl_ObjType tkBitmapObjType = {
125125 "bitmap", /* name */
126126 FreeBitmapObjProc, /* freeIntRepProc */
127127 DupBitmapObjProc, /* dupIntRepProc */
966966 Tcl_GetString(objPtr);
967967 typePtr = objPtr->typePtr;
968968 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
969 (*typePtr->freeIntRepProc)(objPtr);
969 typePtr->freeIntRepProc(objPtr);
970970 }
971971 objPtr->typePtr = &tkBitmapObjType;
972972 objPtr->internalRep.twoPtrValue.ptr1 = NULL;
10901090 {
10911091 char *data;
10921092
1093 data = TkGetBitmapData(NULL, NULL, (char *) filename,
1093 data = TkGetBitmapData(NULL, NULL, filename,
10941094 (int *) width_return, (int *) height_return, x_hot_return,
10951095 y_hot_return);
10961096 if (data == NULL) {
0 /*
1 * tkBusy.c --
2 *
3 * This file provides functions that implement busy for Tk.
4 *
5 * Copyright 1993-1998 Lucent Technologies, Inc.
6 *
7 * The "busy" command was created by George Howlett. Adapted for
8 * integration into Tk by Jos Decoster and Donal K. Fellows.
9 *
10 * See the file "license.terms" for information on usage and redistribution of
11 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 *
13 * RCS: @(#) $Id: tkBusy.c,v 1.6 2008/12/10 00:34:51 das Exp $
14 */
15
16 #include "tkInt.h"
17 #include "tkBusy.h"
18 #include "default.h"
19
20 /*
21 * Things about the busy system that may be configured. Note that currently on
22 * OSX/Aqua, that's nothing at all.
23 */
24
25 static Tk_OptionSpec busyOptionSpecs[] = {
26 #ifndef MAC_OSX_TK
27 {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
28 DEF_BUSY_CURSOR, -1, Tk_Offset(Busy, cursor),
29 TK_OPTION_NULL_OK, 0, 0},
30 #endif
31 {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0}
32 };
33
34 /*
35 * Forward declarations of functions defined in this file.
36 */
37
38 static void BusyEventProc(ClientData clientData,
39 XEvent *eventPtr);
40 static void BusyGeometryProc(ClientData clientData,
41 Tk_Window tkwin);
42 static void BusyCustodyProc(ClientData clientData,
43 Tk_Window tkwin);
44 static int ConfigureBusy(Tcl_Interp *interp, Busy *busyPtr,
45 int objc, Tcl_Obj *const objv[]);
46 static Busy * CreateBusy(Tcl_Interp *interp, Tk_Window tkRef);
47 static void DestroyBusy(char *dataPtr);
48 static void DoConfigureNotify(Tk_FakeWin *winPtr);
49 static inline Tk_Window FirstChild(Tk_Window parent);
50 static Busy * GetBusy(Tcl_Interp *interp,
51 Tcl_HashTable *busyTablePtr,
52 Tcl_Obj *const windowObj);
53 static int HoldBusy(Tcl_HashTable *busyTablePtr,
54 Tcl_Interp *interp, Tcl_Obj *const windowObj,
55 int configObjc, Tcl_Obj *const configObjv[]);
56 static void MakeTransparentWindowExist(Tk_Window tkwin,
57 Window parent);
58 static inline Tk_Window NextChild(Tk_Window tkwin);
59 static void RefWinEventProc(ClientData clientData,
60 register XEvent *eventPtr);
61 static inline void SetWindowInstanceData(Tk_Window tkwin,
62 ClientData instanceData);
63
64 /*
65 * The "busy" geometry manager definition.
66 */
67
68 static Tk_GeomMgr busyMgrInfo = {
69 "busy", /* Name of geometry manager used by winfo */
70 BusyGeometryProc, /* Procedure to for new geometry requests */
71 BusyCustodyProc, /* Procedure when window is taken away */
72 };
73
74 /*
75 * Helper functions, need to check if a Tcl/Tk alternative already exists.
76 */
77
78 static inline Tk_Window
79 FirstChild(
80 Tk_Window parent)
81 {
82 struct TkWindow *parentPtr = (struct TkWindow *) parent;
83
84 return (Tk_Window) parentPtr->childList;
85 }
86
87 static inline Tk_Window
88 NextChild(
89 Tk_Window tkwin)
90 {
91 struct TkWindow *winPtr = (struct TkWindow *) tkwin;
92
93 if (winPtr == NULL) {
94 return NULL;
95 }
96 return (Tk_Window) winPtr->nextPtr;
97 }
98
99 static inline void
100 SetWindowInstanceData(
101 Tk_Window tkwin,
102 ClientData instanceData)
103 {
104 struct TkWindow *winPtr = (struct TkWindow *) tkwin;
105
106 winPtr->instanceData = instanceData;
107 }
108
109 /*
110 *----------------------------------------------------------------------
111 *
112 * BusyCustodyProc --
113 *
114 * This procedure is invoked when the busy window has been stolen by
115 * another geometry manager. The information and memory associated with
116 * the busy window is released. I don't know why anyone would try to pack
117 * a busy window, but this should keep everything sane, if it is.
118 *
119 * Results:
120 * None.
121 *
122 * Side effects:
123 * The Busy structure is freed at the next idle point.
124 *
125 *----------------------------------------------------------------------
126 */
127
128 /* ARGSUSED */
129 static void
130 BusyCustodyProc(
131 ClientData clientData, /* Information about the busy window. */
132 Tk_Window tkwin) /* Not used. */
133 {
134 Busy *busyPtr = clientData;
135
136 Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc,
137 busyPtr);
138 TkpHideBusyWindow(busyPtr);
139 busyPtr->tkBusy = NULL;
140 Tcl_EventuallyFree(busyPtr, DestroyBusy);
141 }
142
143 /*
144 *----------------------------------------------------------------------
145 *
146 * BusyGeometryProc --
147 *
148 * This procedure is invoked by Tk_GeometryRequest for busy windows.
149 * Busy windows never request geometry, so it's unlikely that this
150 * function will ever be called;it exists simply as a place holder for
151 * the GeomProc in the Geometry Manager structure.
152 *
153 * Results:
154 * None.
155 *
156 * Side effects:
157 * None.
158 *
159 *----------------------------------------------------------------------
160 */
161
162 /* ARGSUSED */
163 static void
164 BusyGeometryProc(
165 ClientData clientData, /* Information about window that got new
166 * preferred geometry. */
167 Tk_Window tkwin) /* Other Tk-related information about the
168 * window. */
169 {
170 /* Should never get here */
171 }
172
173 /*
174 *----------------------------------------------------------------------
175 *
176 * DoConfigureNotify --
177 *
178 * Generate a ConfigureNotify event describing the current configuration
179 * of a window.
180 *
181 * Results:
182 * None.
183 *
184 * Side effects:
185 * An event is generated and processed by Tk_HandleEvent.
186 *
187 *----------------------------------------------------------------------
188 */
189
190 static void
191 DoConfigureNotify(
192 Tk_FakeWin *winPtr) /* Window whose configuration was just
193 * changed. */
194 {
195 XEvent event;
196
197 event.type = ConfigureNotify;
198 event.xconfigure.serial = LastKnownRequestProcessed(winPtr->display);
199 event.xconfigure.send_event = False;
200 event.xconfigure.display = winPtr->display;
201 event.xconfigure.event = winPtr->window;
202 event.xconfigure.window = winPtr->window;
203 event.xconfigure.x = winPtr->changes.x;
204 event.xconfigure.y = winPtr->changes.y;
205 event.xconfigure.width = winPtr->changes.width;
206 event.xconfigure.height = winPtr->changes.height;
207 event.xconfigure.border_width = winPtr->changes.border_width;
208 if (winPtr->changes.stack_mode == Above) {
209 event.xconfigure.above = winPtr->changes.sibling;
210 } else {
211 event.xconfigure.above = None;
212 }
213 event.xconfigure.override_redirect = winPtr->atts.override_redirect;
214 Tk_HandleEvent(&event);
215 }
216
217 /*
218 *----------------------------------------------------------------------
219 *
220 * RefWinEventProc --
221 *
222 * This procedure is invoked by the Tk dispatcher for the following
223 * events on the reference window. If the reference and parent windows
224 * are the same, only the first event is important.
225 *
226 * 1) ConfigureNotify The reference window has been resized or
227 * moved. Move and resize the busy window to be
228 * the same size and position of the reference
229 * window.
230 *
231 * 2) DestroyNotify The reference window was destroyed. Destroy
232 * the busy window and the free resources used.
233 *
234 * 3) MapNotify The reference window was (re)shown. Map the
235 * busy window again.
236 *
237 * 4) UnmapNotify The reference window was hidden. Unmap the
238 * busy window.
239 *
240 * Results:
241 * None.
242 *
243 * Side effects:
244 * When the reference window gets deleted, internal structures get
245 * cleaned up. When it gets resized, the busy window is resized
246 * accordingly. If it's displayed, the busy window is displayed. And when
247 * it's hidden, the busy window is unmapped.
248 *
249 *----------------------------------------------------------------------
250 */
251
252 static void
253 RefWinEventProc(
254 ClientData clientData, /* Busy window record */
255 register XEvent *eventPtr) /* Event which triggered call to routine */
256 {
257 register Busy *busyPtr = clientData;
258
259 switch (eventPtr->type) {
260 case ReparentNotify:
261 case DestroyNotify:
262 /*
263 * Arrange for the busy structure to be removed at a proper time.
264 */
265
266 Tcl_EventuallyFree(busyPtr, DestroyBusy);
267 break;
268
269 case ConfigureNotify:
270 if ((busyPtr->width != Tk_Width(busyPtr->tkRef)) ||
271 (busyPtr->height != Tk_Height(busyPtr->tkRef)) ||
272 (busyPtr->x != Tk_X(busyPtr->tkRef)) ||
273 (busyPtr->y != Tk_Y(busyPtr->tkRef))) {
274 int x, y;
275
276 busyPtr->width = Tk_Width(busyPtr->tkRef);
277 busyPtr->height = Tk_Height(busyPtr->tkRef);
278 busyPtr->x = Tk_X(busyPtr->tkRef);
279 busyPtr->y = Tk_Y(busyPtr->tkRef);
280
281 x = y = 0;
282
283 if (busyPtr->tkParent != busyPtr->tkRef) {
284 Tk_Window tkwin;
285
286 for (tkwin = busyPtr->tkRef; (tkwin != NULL) &&
287 (!Tk_IsTopLevel(tkwin)); tkwin = Tk_Parent(tkwin)) {
288 if (tkwin == busyPtr->tkParent) {
289 break;
290 }
291 x += Tk_X(tkwin) + Tk_Changes(tkwin)->border_width;
292 y += Tk_Y(tkwin) + Tk_Changes(tkwin)->border_width;
293 }
294 }
295 if (busyPtr->tkBusy != NULL) {
296 Tk_MoveResizeWindow(busyPtr->tkBusy, x, y, busyPtr->width,
297 busyPtr->height);
298 TkpShowBusyWindow(busyPtr);
299 }
300 }
301 break;
302
303 case MapNotify:
304 if (busyPtr->tkParent != busyPtr->tkRef) {
305 TkpShowBusyWindow(busyPtr);
306 }
307 break;
308
309 case UnmapNotify:
310 if (busyPtr->tkParent != busyPtr->tkRef) {
311 TkpHideBusyWindow(busyPtr);
312 }
313 break;
314 }
315 }
316
317 /*
318 *----------------------------------------------------------------------
319 *
320 * DestroyBusy --
321 *
322 * This procedure is called from the Tk event dispatcher. It releases X
323 * resources and memory used by the busy window and updates the internal
324 * hash table.
325 *
326 * Results:
327 * None.
328 *
329 * Side effects:
330 * Memory and resources are released and the Tk event handler is removed.
331 *
332 *----------------------------------------------------------------------
333 */
334
335 static void
336 DestroyBusy(
337 char *data) /* Busy window structure record */
338 {
339 register Busy *busyPtr = (Busy *) data;
340
341 if (busyPtr->hashPtr != NULL) {
342 Tcl_DeleteHashEntry(busyPtr->hashPtr);
343 }
344 Tk_DeleteEventHandler(busyPtr->tkRef, StructureNotifyMask,
345 RefWinEventProc, busyPtr);
346
347 if (busyPtr->tkBusy != NULL) {
348 Tk_FreeConfigOptions(data, busyPtr->optionTable, busyPtr->tkBusy);
349 Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask,
350 BusyEventProc, busyPtr);
351 Tk_ManageGeometry(busyPtr->tkBusy, NULL, busyPtr);
352 Tk_DestroyWindow(busyPtr->tkBusy);
353 }
354 ckfree(data);
355 }
356
357 /*
358 *----------------------------------------------------------------------
359 *
360 * BusyEventProc --
361 *
362 * This procedure is invoked by the Tk dispatcher for events on the busy
363 * window itself. We're only concerned with destroy events.
364 *
365 * It might be necessary (someday) to watch resize events. Right now, I
366 * don't think there's any point in it.
367 *
368 * Results:
369 * None.
370 *
371 * Side effects:
372 * When a busy window is destroyed, all internal structures associated
373 * with it released at the next idle point.
374 *
375 *----------------------------------------------------------------------
376 */
377
378 static void
379 BusyEventProc(
380 ClientData clientData, /* Busy window record */
381 XEvent *eventPtr) /* Event which triggered call to routine */
382 {
383 Busy *busyPtr = clientData;
384
385 if (eventPtr->type == DestroyNotify) {
386 busyPtr->tkBusy = NULL;
387 Tcl_EventuallyFree(busyPtr, DestroyBusy);
388 }
389 }
390
391 /*
392 *----------------------------------------------------------------------
393 *
394 * MakeTransparentWindowExist --
395 *
396 * Similar to Tk_MakeWindowExist but instead creates a transparent window
397 * to block for user events from sibling windows.
398 *
399 * Differences from Tk_MakeWindowExist.
400 *
401 * 1. This is always a "busy" window. There's never a platform-specific
402 * class procedure to execute instead.
403 * 2. The window is transparent and never will contain children, so
404 * colormap information is irrelevant.
405 *
406 * Results:
407 * None.
408 *
409 * Side effects:
410 * When the procedure returns, the internal window associated with tkwin
411 * is guaranteed to exist. This may require the window's ancestors to be
412 * created too.
413 *
414 *----------------------------------------------------------------------
415 */
416
417 static void
418 MakeTransparentWindowExist(
419 Tk_Window tkwin, /* Token for window. */
420 Window parent) /* Parent window. */
421 {
422 TkWindow *winPtr = (TkWindow *) tkwin;
423 Tcl_HashEntry *hPtr;
424 int notUsed;
425 TkDisplay *dispPtr;
426
427 if (winPtr->window != None) {
428 return; /* Window already exists. */
429 }
430
431 /*
432 * Create a transparent window and put it on top.
433 */
434
435 TkpMakeTransparentWindowExist(tkwin, parent);
436
437 dispPtr = winPtr->dispPtr;
438 hPtr = Tcl_CreateHashEntry(&dispPtr->winTable, (char *) winPtr->window,
439 &notUsed);
440 Tcl_SetHashValue(hPtr, winPtr);
441 winPtr->dirtyAtts = 0;
442 winPtr->dirtyChanges = 0;
443
444 if (!(winPtr->flags & TK_TOP_HIERARCHY)) {
445 TkWindow *winPtr2;
446
447 /*
448 * If any siblings higher up in the stacking order have already been
449 * created then move this window to its rightful position in the
450 * stacking order.
451 *
452 * NOTE: this code ignores any changes anyone might have made to the
453 * sibling and stack_mode field of the window's attributes, so it
454 * really isn't safe for these to be manipulated except by calling
455 * Tk_RestackWindow.
456 */
457
458 for (winPtr2 = winPtr->nextPtr; winPtr2 != NULL;
459 winPtr2 = winPtr2->nextPtr) {
460 if ((winPtr2->window != None) &&
461 !(winPtr2->flags & (TK_TOP_HIERARCHY|TK_REPARENTED))) {
462 XWindowChanges changes;
463
464 changes.sibling = winPtr2->window;
465 changes.stack_mode = Below;
466 XConfigureWindow(winPtr->display, winPtr->window,
467 CWSibling | CWStackMode, &changes);
468 break;
469 }
470 }
471 }
472
473 /*
474 * Issue a ConfigureNotify event if there were deferred configuration
475 * changes (but skip it if the window is being deleted; the
476 * ConfigureNotify event could cause problems if we're being called from
477 * Tk_DestroyWindow under some conditions).
478 */
479
480 if ((winPtr->flags & TK_NEED_CONFIG_NOTIFY)
481 && !(winPtr->flags & TK_ALREADY_DEAD)) {
482 winPtr->flags &= ~TK_NEED_CONFIG_NOTIFY;
483 DoConfigureNotify((Tk_FakeWin *) tkwin);
484 }
485 }
486
487 /*
488 *----------------------------------------------------------------------
489 *
490 * CreateBusy --
491 *
492 * Creates a child transparent window that obscures its parent window
493 * thereby effectively blocking device events. The size and position of
494 * the busy window is exactly that of the reference window.
495 *
496 * We want to create sibling to the window to be blocked. If the busy
497 * window is a child of the window to be blocked, Enter/Leave events can
498 * sneak through. Futhermore under WIN32, messages of transparent windows
499 * are sent directly to the parent. The only exception to this are
500 * toplevels, since we can't make a sibling. Fortunately, toplevel
501 * windows rarely receive events that need blocking.
502 *
503 * Results:
504 * Returns a pointer to the new busy window structure.
505 *
506 * Side effects:
507 * When the busy window is eventually displayed, it will screen device
508 * events (in the area of the reference window) from reaching its parent
509 * window and its children. User feed back can be achieved by changing
510 * the cursor.
511 *
512 *----------------------------------------------------------------------
513 */
514
515 static Busy *
516 CreateBusy(
517 Tcl_Interp *interp, /* Interpreter to report error to */
518 Tk_Window tkRef) /* Window hosting the busy window */
519 {
520 Busy *busyPtr;
521 int length, x, y;
522 const char *fmt;
523 char *name;
524 Tk_Window tkBusy, tkChild, tkParent;
525 Window parent;
526 Tk_FakeWin *winPtr;
527
528 busyPtr = (Busy *) ckalloc(sizeof(Busy));
529 x = y = 0;
530 length = strlen(Tk_Name(tkRef));
531 name = ckalloc(length + 6);
532 if (Tk_IsTopLevel(tkRef)) {
533 fmt = "_Busy"; /* Child */
534 tkParent = tkRef;
535 } else {
536 Tk_Window tkwin;
537
538 fmt = "%s_Busy"; /* Sibling */
539 tkParent = Tk_Parent(tkRef);
540 for (tkwin = tkRef; (tkwin != NULL) && !Tk_IsTopLevel(tkwin);
541 tkwin = Tk_Parent(tkwin)) {
542 if (tkwin == tkParent) {
543 break;
544 }
545 x += Tk_X(tkwin) + Tk_Changes(tkwin)->border_width;
546 y += Tk_Y(tkwin) + Tk_Changes(tkwin)->border_width;
547 }
548 }
549 for (tkChild = FirstChild(tkParent); tkChild != NULL;
550 tkChild = NextChild(tkChild)) {
551 Tk_MakeWindowExist(tkChild);
552 }
553 sprintf(name, fmt, Tk_Name(tkRef));
554 tkBusy = Tk_CreateWindow(interp, tkParent, name, NULL);
555 ckfree(name);
556
557 if (tkBusy == NULL) {
558 return NULL;
559 }
560 Tk_MakeWindowExist(tkRef);
561 busyPtr->display = Tk_Display(tkRef);
562 busyPtr->interp = interp;
563 busyPtr->tkRef = tkRef;
564 busyPtr->tkParent = tkParent;
565 busyPtr->tkBusy = tkBusy;
566 busyPtr->width = Tk_Width(tkRef);
567 busyPtr->height = Tk_Height(tkRef);
568 busyPtr->x = Tk_X(tkRef);
569 busyPtr->y = Tk_Y(tkRef);
570 busyPtr->cursor = None;
571 Tk_SetClass(tkBusy, "Busy");
572 busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs);
573 if (Tk_InitOptions(interp, (char *) busyPtr, busyPtr->optionTable,
574 tkBusy) != TCL_OK) {
575 Tk_DestroyWindow(tkBusy);
576 return NULL;
577 }
578 SetWindowInstanceData(tkBusy, busyPtr);
579 winPtr = (Tk_FakeWin *) tkRef;
580
581 TkpCreateBusy(winPtr, tkRef, &parent, tkParent, busyPtr);
582
583 MakeTransparentWindowExist(tkBusy, parent);
584
585 Tk_MoveResizeWindow(tkBusy, x, y, busyPtr->width, busyPtr->height);
586
587 /*
588 * Only worry if the busy window is destroyed.
589 */
590
591 Tk_CreateEventHandler(tkBusy, StructureNotifyMask, BusyEventProc,
592 busyPtr);
593
594 /*
595 * Indicate that the busy window's geometry is being managed. This will
596 * also notify us if the busy window is ever packed.
597 */
598
599 Tk_ManageGeometry(tkBusy, &busyMgrInfo, busyPtr);
600 if (busyPtr->cursor != None) {
601 Tk_DefineCursor(tkBusy, busyPtr->cursor);
602 }
603
604 /*
605 * Track the reference window to see if it is resized or destroyed.
606 */
607
608 Tk_CreateEventHandler(tkRef, StructureNotifyMask, RefWinEventProc,
609 busyPtr);
610 return busyPtr;
611 }
612
613 /*
614 *----------------------------------------------------------------------
615 *
616 * ConfigureBusy --
617 *
618 * This procedure is called from the Tk event dispatcher. It releases X
619 * resources and memory used by the busy window and updates the internal
620 * hash table.
621 *
622 * Results:
623 * None.
624 *
625 * Side effects:
626 * Memory and resources are released and the Tk event handler is removed.
627 *
628 *----------------------------------------------------------------------
629 */
630
631 static int
632 ConfigureBusy(
633 Tcl_Interp *interp,
634 Busy *busyPtr,
635 int objc,
636 Tcl_Obj *const objv[])
637 {
638 Tk_Cursor oldCursor = busyPtr->cursor;
639
640 if (Tk_SetOptions(interp, (char *) busyPtr, busyPtr->optionTable, objc,
641 objv, busyPtr->tkBusy, NULL, NULL) != TCL_OK) {
642 return TCL_ERROR;
643 }
644 if (busyPtr->cursor != oldCursor) {
645 if (busyPtr->cursor == None) {
646 Tk_UndefineCursor(busyPtr->tkBusy);
647 } else {
648 Tk_DefineCursor(busyPtr->tkBusy, busyPtr->cursor);
649 }
650 }
651
652 return TCL_OK;
653 }
654
655 /*
656 *----------------------------------------------------------------------
657 *
658 * GetBusy --
659 *
660 * Returns the busy window structure associated with the reference
661 * window, keyed by its path name. The clientData argument is the main
662 * window of the interpreter, used to search for the reference window in
663 * its own window hierarchy.
664 *
665 * Results:
666 * If path name represents a reference window with a busy window, a
667 * pointer to the busy window structure is returned. Otherwise, NULL is
668 * returned and an error message is left in interp->result.
669 *
670 * Side effects:
671 * None.
672 *
673 *----------------------------------------------------------------------
674 */
675
676 static Busy *
677 GetBusy(
678 Tcl_Interp *interp, /* Interpreter to look up main window of. */
679 Tcl_HashTable *busyTablePtr,/* Busy hash table */
680 Tcl_Obj *const windowObj) /* Path name of parent window */
681 {
682 Tcl_HashEntry *hPtr;
683 Tk_Window tkwin;
684
685 if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), windowObj,
686 &tkwin) != TCL_OK) {
687 return NULL;
688 }
689 hPtr = Tcl_FindHashEntry(busyTablePtr, (char *) tkwin);
690 if (hPtr == NULL) {
691 Tcl_AppendResult(interp, "can't find busy window \"",
692 Tcl_GetString(windowObj), "\"", NULL);
693 return NULL;
694 }
695 return Tcl_GetHashValue(hPtr);
696 }
697
698 /*
699 *----------------------------------------------------------------------
700 *
701 * HoldBusy --
702 *
703 * Creates (if necessary) and maps a busy window, thereby preventing
704 * device events from being be received by the parent window and its
705 * children.
706 *
707 * Results:
708 * Returns a standard TCL result. If path name represents a busy window,
709 * it is unmapped and TCL_OK is returned. Otherwise, TCL_ERROR is
710 * returned and an error message is left in interp->result.
711 *
712 * Side effects:
713 * The busy window is created and displayed, blocking events from the
714 * parent window and its children.
715 *
716 *----------------------------------------------------------------------
717 */
718
719 static int
720 HoldBusy(
721 Tcl_HashTable *busyTablePtr,/* Busy hash table. */
722 Tcl_Interp *interp, /* Interpreter to report errors to. */
723 Tcl_Obj *const windowObj, /* Window name. */
724 int configObjc, /* Option pairs. */
725 Tcl_Obj *const configObjv[])
726 {
727 Tk_Window tkwin;
728 Tcl_HashEntry *hPtr;
729 Busy *busyPtr;
730 int isNew, result;
731
732 if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), windowObj,
733 &tkwin) != TCL_OK) {
734 return TCL_ERROR;
735 }
736 hPtr = Tcl_CreateHashEntry(busyTablePtr, (char *) tkwin, &isNew);
737 if (isNew) {
738 busyPtr = CreateBusy(interp, tkwin);
739 if (busyPtr == NULL) {
740 return TCL_ERROR;
741 }
742 Tcl_SetHashValue(hPtr, busyPtr);
743 busyPtr->hashPtr = hPtr;
744 } else {
745 busyPtr = Tcl_GetHashValue(hPtr);
746 }
747
748 busyPtr->tablePtr = busyTablePtr;
749 result = ConfigureBusy(interp, busyPtr, configObjc, configObjv);
750
751 /*
752 * Don't map the busy window unless the reference window is also currently
753 * displayed.
754 */
755
756 if (Tk_IsMapped(busyPtr->tkRef)) {
757 TkpShowBusyWindow(busyPtr);
758 } else {
759 TkpHideBusyWindow(busyPtr);
760 }
761 return result;
762 }
763
764 /*
765 *----------------------------------------------------------------------
766 *
767 * Tk_BusyObjCmd --
768 *
769 * This function is invoked to process the "tk busy" Tcl command. See the
770 * user documentation for details on what it does.
771 *
772 * Results:
773 * A standard Tcl result.
774 *
775 * Side effects:
776 * See the user documentation.
777 *
778 *----------------------------------------------------------------------
779 */
780
781 int
782 Tk_BusyObjCmd(
783 ClientData clientData, /* Main window associated with interpreter. */
784 Tcl_Interp *interp, /* Current interpreter. */
785 int objc, /* Number of arguments. */
786 Tcl_Obj *const objv[]) /* Argument objects. */
787 {
788 Tk_Window tkwin = clientData;
789 Tcl_HashTable *busyTablePtr = &((TkWindow *) tkwin)->mainPtr->busyTable;
790 Busy *busyPtr;
791 Tcl_Obj *objPtr;
792 int index, result = TCL_OK;
793 static const char *optionStrings[] = {
794 "cget", "configure", "current", "forget", "hold", "status", NULL
795 };
796 enum options {
797 BUSY_CGET, BUSY_CONFIGURE, BUSY_CURRENT, BUSY_FORGET, BUSY_HOLD,
798 BUSY_STATUS
799 };
800
801 if (objc < 2) {
802 Tcl_WrongNumArgs(interp, 1, objv, "options ?arg arg ...?");
803 return TCL_ERROR;
804 }
805
806 /*
807 * [tk busy <window>] command shortcut.
808 */
809
810 if (Tcl_GetString(objv[1])[0] == '.') {
811 if (objc%2 == 1) {
812 Tcl_WrongNumArgs(interp, 1, objv, "window ?option value ...?");
813 return TCL_ERROR;
814 }
815 return HoldBusy(busyTablePtr, interp, objv[1], objc-2, objv+2);
816 }
817
818 if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
819 &index) != TCL_OK) {
820 return TCL_ERROR;
821 }
822 switch ((enum options) index) {
823 case BUSY_CGET:
824 if (objc != 4) {
825 Tcl_WrongNumArgs(interp, 2, objv, "window option");
826 return TCL_ERROR;
827 }
828 busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
829 if (busyPtr == NULL) {
830 return TCL_ERROR;
831 }
832 Tcl_Preserve(busyPtr);
833 objPtr = Tk_GetOptionValue(interp, (char *) busyPtr,
834 busyPtr->optionTable, objv[3], busyPtr->tkBusy);
835 if (objPtr == NULL) {
836 result = TCL_ERROR;
837 } else {
838 Tcl_SetObjResult(interp, objPtr);
839 }
840 Tcl_Release(busyPtr);
841 return result;
842
843 case BUSY_CONFIGURE:
844 if (objc < 3) {
845 Tcl_WrongNumArgs(interp, 2, objv, "window ?option? ?value ...?");
846 return TCL_ERROR;
847 }
848 busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
849 if (busyPtr == NULL) {
850 return TCL_ERROR;
851 }
852 Tcl_Preserve(busyPtr);
853 if (objc <= 4) {
854 objPtr = Tk_GetOptionInfo(interp, (char *) busyPtr,
855 busyPtr->optionTable, (objc == 4) ? objv[3] : NULL,
856 busyPtr->tkBusy);
857 if (objPtr == NULL) {
858 result = TCL_ERROR;
859 } else {
860 Tcl_SetObjResult(interp, objPtr);
861 }
862 } else {
863 result = ConfigureBusy(interp, busyPtr, objc-3, objv+3);
864 }
865 Tcl_Release(busyPtr);
866 return result;
867
868 case BUSY_CURRENT: {
869 Tcl_HashEntry *hPtr;
870 Tcl_HashSearch cursor;
871 const char *pattern = (objc == 3 ? Tcl_GetString(objv[2]) : NULL);
872
873 objPtr = Tcl_NewObj();
874 for (hPtr = Tcl_FirstHashEntry(busyTablePtr, &cursor); hPtr != NULL;
875 hPtr = Tcl_NextHashEntry(&cursor)) {
876 busyPtr = Tcl_GetHashValue(hPtr);
877 if (pattern == NULL ||
878 Tcl_StringMatch(Tk_PathName(busyPtr->tkRef), pattern)) {
879 Tcl_ListObjAppendElement(interp, objPtr,
880 TkNewWindowObj(busyPtr->tkRef));
881 }
882 }
883 Tcl_SetObjResult(interp, objPtr);
884 return TCL_OK;
885 }
886
887 case BUSY_FORGET:
888 if (objc != 3) {
889 Tcl_WrongNumArgs(interp, 2, objv, "window");
890 return TCL_ERROR;
891 }
892 busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
893 if (busyPtr == NULL) {
894 return TCL_ERROR;
895 }
896 TkpHideBusyWindow(busyPtr);
897 Tcl_EventuallyFree(busyPtr, DestroyBusy);
898 return TCL_OK;
899
900 case BUSY_HOLD:
901 if (objc < 3 || objc%2 != 1) {
902 Tcl_WrongNumArgs(interp, 2, objv, "window ?option value ...?");
903 return TCL_ERROR;
904 }
905 return HoldBusy(busyTablePtr, interp, objv[2], objc-3, objv+3);
906
907 case BUSY_STATUS:
908 if (objc != 3) {
909 Tcl_WrongNumArgs(interp, 2, objv, "window");
910 return TCL_ERROR;
911 }
912 Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
913 GetBusy(interp, busyTablePtr, objv[2]) != NULL));
914 return TCL_OK;
915 }
916
917 Tcl_Panic("unhandled option: %d", index);
918 return TCL_ERROR; /* Unreachable */
919 }
920
921 /*
922 * Local Variables:
923 * mode: c
924 * c-basic-offset: 4
925 * fill-column: 78
926 * End:
927 */
0 /*
1 * tkBusy.h --
2 *
3 * This file defines the type of the structure describing a busy window.
4 *
5 * Copyright 1993-1998 Lucent Technologies, Inc.
6 *
7 * The "busy" command was created by George Howlett. Adapted for
8 * integration into Tk by Jos Decoster and Donal K. Fellows.
9 *
10 * See the file "license.terms" for information on usage and redistribution of
11 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 *
13 * RCS: @(#) $Id: tkBusy.h,v 1.1 2008/10/20 10:50:20 dkf Exp $
14 */
15
16 typedef struct Busy {
17 Display *display; /* Display of busy window */
18 Tcl_Interp *interp; /* Interpreter where "busy" command was
19 * created. It's used to key the searches in
20 * the window hierarchy. See the "windows"
21 * command. */
22 Tk_Window tkBusy; /* Busy window: Transparent window used to
23 * block delivery of events to windows
24 * underneath it. */
25 Tk_Window tkParent; /* Parent window of the busy window. It may be
26 * the reference window (if the reference is a
27 * toplevel) or a mutual ancestor of the
28 * reference window */
29 Tk_Window tkRef; /* Reference window of the busy window. It is
30 * used to manage the size and position of the
31 * busy window. */
32 int x, y; /* Position of the reference window */
33 int width, height; /* Size of the reference window. Retained to
34 * know if the reference window has been
35 * reconfigured to a new size. */
36 int menuBar; /* Menu bar flag. */
37 Tk_Cursor cursor; /* Cursor for the busy window. */
38 Tcl_HashEntry *hashPtr; /* Used the delete the busy window entry out
39 * of the global hash table. */
40 Tcl_HashTable *tablePtr;
41 Tk_OptionTable optionTable;
42 } Busy;
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkButton.c,v 1.30 2008/10/05 18:22:21 dkf Exp $
13 * RCS: @(#) $Id: tkButton.c,v 1.33 2008/11/08 22:52:29 dkf Exp $
1414 */
1515
1616 #include "tkInt.h"
2727 * tkButton.h.
2828 */
2929
30 static const char *classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"};
30 static const char *const classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"};
3131
3232 /*
3333 * The following table defines the legal values for the -default option. It is
3434 * used together with the "enum defaultValue" declaration in tkButton.h.
3535 */
3636
37 static const char *defaultStrings[] = {
37 static const char *const defaultStrings[] = {
3838 "active", "disabled", "normal", NULL
3939 };
4040
4343 * It is used together with the "enum state" declaration in tkButton.h.
4444 */
4545
46 static const char *stateStrings[] = {
46 static const char *const stateStrings[] = {
4747 "active", "disabled", "normal", NULL
4848 };
4949
5252 * It is used with the "enum compound" declaration in tkButton.h
5353 */
5454
55 static const char *compoundStrings[] = {
55 static const char *const compoundStrings[] = {
5656 "bottom", "center", "left", "none", "right", "top", NULL
5757 };
5858
477477 * such as TYPE_LABEL, to the option template for that class of widgets.
478478 */
479479
480 static Tk_OptionSpec * const optionSpecs[] = {
480 static Tk_OptionSpec *const optionSpecs[] = {
481481 labelOptionSpecs,
482482 buttonOptionSpecs,
483483 checkbuttonOptionSpecs,
490490 * enumerated type used to dispatch the widget command.
491491 */
492492
493 static const char *commandNames[][8] = {
493 static const char *const commandNames[][8] = {
494494 {"cget", "configure", NULL},
495495 {"cget", "configure", "flash", "invoke", NULL},
496496 {"cget", "configure", "deselect", "flash", "invoke", "select",
665665 Tk_SetClass(tkwin, classNames[type]);
666666 butPtr = TkpCreateButton(tkwin);
667667
668 Tk_SetClassProcs(tkwin, &tkpButtonProcs, (ClientData) butPtr);
668 Tk_SetClassProcs(tkwin, &tkpButtonProcs, butPtr);
669669
670670 /*
671671 * Initialize the data structure for the button.
675675 butPtr->display = Tk_Display(tkwin);
676676 butPtr->interp = interp;
677677 butPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin),
678 ButtonWidgetObjCmd, (ClientData) butPtr, ButtonCmdDeletedProc);
678 ButtonWidgetObjCmd, butPtr, ButtonCmdDeletedProc);
679679 butPtr->type = type;
680680 butPtr->optionTable = optionTable;
681681 butPtr->textPtr = NULL;
740740
741741 Tk_CreateEventHandler(butPtr->tkwin,
742742 ExposureMask|StructureNotifyMask|FocusChangeMask,
743 ButtonEventProc, (ClientData) butPtr);
743 ButtonEventProc, butPtr);
744744
745745 if (Tk_InitOptions(interp, (char *) butPtr, optionTable, tkwin)
746746 != TCL_OK) {
752752 return TCL_ERROR;
753753 }
754754
755 Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(butPtr->tkwin),-1));
755 Tcl_SetObjResult(interp, TkNewWindowObj(butPtr->tkwin));
756756 return TCL_OK;
757757 }
758758
781781 int objc, /* Number of arguments. */
782782 Tcl_Obj *const objv[]) /* Argument values. */
783783 {
784 TkButton *butPtr = (TkButton *) clientData;
784 TkButton *butPtr = clientData;
785785 int index;
786786 int result;
787787 Tcl_Obj *objPtr;
795795 if (result != TCL_OK) {
796796 return result;
797797 }
798 Tcl_Preserve((ClientData) butPtr);
798 Tcl_Preserve(butPtr);
799799
800800 switch (map[butPtr->type][index]) {
801801 case COMMAND_CGET:
807807 butPtr->optionTable, objv[2], butPtr->tkwin);
808808 if (objPtr == NULL) {
809809 goto error;
810 } else {
811 Tcl_SetObjResult(interp, objPtr);
812 }
810 }
811 Tcl_SetObjResult(interp, objPtr);
813812 break;
814813
815814 case COMMAND_CONFIGURE:
819818 butPtr->tkwin);
820819 if (objPtr == NULL) {
821820 goto error;
822 } else {
823 Tcl_SetObjResult(interp, objPtr);
824821 }
822 Tcl_SetObjResult(interp, objPtr);
825823 } else {
826824 result = ConfigureButton(interp, butPtr, objc-2, objv+2);
827825 }
864862 Tk_SetBackgroundFromBorder(butPtr->tkwin,
865863 butPtr->normalBorder);
866864 }
867 TkpDisplayButton((ClientData) butPtr);
865 TkpDisplayButton(butPtr);
868866
869867 /*
870868 * Special note: must cancel any existing idle handler for
872870 * TkpDisplayButton cleared the REDRAW_PENDING flag.
873871 */
874872
875 Tcl_CancelIdleCall(TkpDisplayButton, (ClientData) butPtr);
873 Tcl_CancelIdleCall(TkpDisplayButton, butPtr);
876874 XFlush(butPtr->display);
877875 Tcl_Sleep(50);
878876 }
914912 }
915913 break;
916914 }
917 Tcl_Release((ClientData) butPtr);
915 Tcl_Release(butPtr);
918916 return result;
919917
920918 error:
921 Tcl_Release((ClientData) butPtr);
919 Tcl_Release(butPtr);
922920 return TCL_ERROR;
923921 }
924922
947945 TkpDestroyButton(butPtr);
948946
949947 if (butPtr->flags & REDRAW_PENDING) {
950 Tcl_CancelIdleCall(TkpDisplayButton, (ClientData) butPtr);
948 Tcl_CancelIdleCall(TkpDisplayButton, butPtr);
951949 }
952950
953951 /*
959957 if (butPtr->textVarNamePtr != NULL) {
960958 Tcl_UntraceVar(butPtr->interp, Tcl_GetString(butPtr->textVarNamePtr),
961959 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
962 ButtonTextVarProc, (ClientData) butPtr);
960 ButtonTextVarProc, butPtr);
963961 }
964962 if (butPtr->image != NULL) {
965963 Tk_FreeImage(butPtr->image);
994992 if (butPtr->selVarNamePtr != NULL) {
995993 Tcl_UntraceVar(butPtr->interp, Tcl_GetString(butPtr->selVarNamePtr),
996994 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
997 ButtonVarProc, (ClientData) butPtr);
995 ButtonVarProc, butPtr);
998996 }
999997 Tk_FreeConfigOptions((char *) butPtr, butPtr->optionTable,
1000998 butPtr->tkwin);
1001999 butPtr->tkwin = NULL;
1002 Tcl_EventuallyFree((ClientData) butPtr, TCL_DYNAMIC);
1000 Tcl_EventuallyFree(butPtr, TCL_DYNAMIC);
10031001 }
10041002
10051003 /*
10421040 if (butPtr->textVarNamePtr != NULL) {
10431041 Tcl_UntraceVar(interp, Tcl_GetString(butPtr->textVarNamePtr),
10441042 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
1045 ButtonTextVarProc, (ClientData) butPtr);
1043 ButtonTextVarProc, butPtr);
10461044 }
10471045 if (butPtr->selVarNamePtr != NULL) {
10481046 Tcl_UntraceVar(interp, Tcl_GetString(butPtr->selVarNamePtr),
10491047 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
1050 ButtonVarProc, (ClientData) butPtr);
1048 ButtonVarProc, butPtr);
10511049 }
10521050
10531051 /*
11681166 if (butPtr->imagePtr != NULL) {
11691167 image = Tk_GetImage(butPtr->interp, butPtr->tkwin,
11701168 Tcl_GetString(butPtr->imagePtr), ButtonImageProc,
1171 (ClientData) butPtr);
1169 butPtr);
11721170 if (image == NULL) {
11731171 continue;
11741172 }
11821180 if (butPtr->selectImagePtr != NULL) {
11831181 image = Tk_GetImage(butPtr->interp, butPtr->tkwin,
11841182 Tcl_GetString(butPtr->selectImagePtr),
1185 ButtonSelectImageProc, (ClientData) butPtr);
1183 ButtonSelectImageProc, butPtr);
11861184 if (image == NULL) {
11871185 continue;
11881186 }
11961194 if (butPtr->tristateImagePtr != NULL) {
11971195 image = Tk_GetImage(butPtr->interp, butPtr->tkwin,
11981196 Tcl_GetString(butPtr->tristateImagePtr),
1199 ButtonTristateImageProc, (ClientData) butPtr);
1197 ButtonTristateImageProc, butPtr);
12001198 if (image == NULL) {
12011199 continue;
12021200 }
12831281 if (butPtr->textVarNamePtr != NULL) {
12841282 Tcl_TraceVar(interp, Tcl_GetString(butPtr->textVarNamePtr),
12851283 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
1286 ButtonTextVarProc, (ClientData) butPtr);
1284 ButtonTextVarProc, butPtr);
12871285 }
12881286 if (butPtr->selVarNamePtr != NULL) {
12891287 Tcl_TraceVar(interp, Tcl_GetString(butPtr->selVarNamePtr),
12901288 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
1291 ButtonVarProc, (ClientData) butPtr);
1292 }
1293
1294 TkButtonWorldChanged((ClientData) butPtr);
1289 ButtonVarProc, butPtr);
1290 }
1291
1292 TkButtonWorldChanged(butPtr);
12951293 if (error) {
12961294 Tcl_SetObjResult(interp, errorResult);
12971295 Tcl_DecrRefCount(errorResult);
14111409 */
14121410
14131411 if (Tk_IsMapped(butPtr->tkwin) && !(butPtr->flags & REDRAW_PENDING)) {
1414 Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
1412 Tcl_DoWhenIdle(TkpDisplayButton, butPtr);
14151413 butPtr->flags |= REDRAW_PENDING;
14161414 }
14171415 }
14391437 ClientData clientData, /* Information about window. */
14401438 XEvent *eventPtr) /* Information about event. */
14411439 {
1442 TkButton *butPtr = (TkButton *) clientData;
1440 TkButton *butPtr = clientData;
14431441 if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
14441442 goto redraw;
14451443 } else if (eventPtr->type == ConfigureNotify) {
14701468
14711469 redraw:
14721470 if ((butPtr->tkwin != NULL) && !(butPtr->flags & REDRAW_PENDING)) {
1473 Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
1471 Tcl_DoWhenIdle(TkpDisplayButton, butPtr);
14741472 butPtr->flags |= REDRAW_PENDING;
14751473 }
14761474 }
14971495 ButtonCmdDeletedProc(
14981496 ClientData clientData) /* Pointer to widget record for widget. */
14991497 {
1500 TkButton *butPtr = (TkButton *) clientData;
1498 TkButton *butPtr = clientData;
15011499
15021500 /*
15031501 * This function could be invoked either because the window was destroyed
15921590 const char *name2, /* Second part of variable name. */
15931591 int flags) /* Information about what happened. */
15941592 {
1595 register TkButton *butPtr = (TkButton *) clientData;
1596 char *name, *value;
1593 register TkButton *butPtr = clientData;
1594 const char *value;
15971595 Tcl_Obj *valuePtr;
1598
1599 name = Tcl_GetString(butPtr->selVarNamePtr);
16001596
16011597 /*
16021598 * If the variable is being unset, then just re-establish the trace unless
16041600 */
16051601
16061602 if (flags & TCL_TRACE_UNSETS) {
1607 butPtr->flags &= ~SELECTED;
1608 butPtr->flags &= ~TRISTATED;
1603 butPtr->flags &= ~(SELECTED | TRISTATED);
16091604 if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
1610 Tcl_TraceVar(interp, name,
1605 Tcl_TraceVar(interp, Tcl_GetString(butPtr->selVarNamePtr),
16111606 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
16121607 ButtonVarProc, clientData);
16131608 }
16191614 * button.
16201615 */
16211616
1622 valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY);
1617 valuePtr = Tcl_ObjGetVar2(interp, butPtr->selVarNamePtr, NULL,
1618 TCL_GLOBAL_ONLY);
16231619 if (valuePtr == NULL) {
16241620 value = "";
16251621 } else {
16461642 redisplay:
16471643 if ((butPtr->tkwin != NULL) && Tk_IsMapped(butPtr->tkwin)
16481644 && !(butPtr->flags & REDRAW_PENDING)) {
1649 Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
1645 Tcl_DoWhenIdle(TkpDisplayButton, butPtr);
16501646 butPtr->flags |= REDRAW_PENDING;
16511647 }
16521648 return NULL;
16781674 const char *name2, /* Not used. */
16791675 int flags) /* Information about what happened. */
16801676 {
1681 TkButton *butPtr = (TkButton *) clientData;
1682 char *name;
1677 TkButton *butPtr = clientData;
16831678 Tcl_Obj *valuePtr;
16841679
16851680 if (butPtr->flags & BUTTON_DELETED) {
16861681 return NULL;
16871682 }
1688
1689 name = Tcl_GetString(butPtr->textVarNamePtr);
16901683
16911684 /*
16921685 * If the variable is unset, then immediately recreate it unless the whole
16951688
16961689 if (flags & TCL_TRACE_UNSETS) {
16971690 if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) {
1698 Tcl_SetVar2Ex(interp, name, NULL, butPtr->textPtr,
1699 TCL_GLOBAL_ONLY);
1700 Tcl_TraceVar(interp, name,
1691 Tcl_ObjSetVar2(interp, butPtr->textVarNamePtr, NULL,
1692 butPtr->textPtr, TCL_GLOBAL_ONLY);
1693 Tcl_TraceVar(interp, Tcl_GetString(butPtr->textVarNamePtr),
17011694 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
17021695 ButtonTextVarProc, clientData);
17031696 }
17041697 return NULL;
17051698 }
17061699
1707 valuePtr = Tcl_GetVar2Ex(interp, name, NULL, TCL_GLOBAL_ONLY);
1700 valuePtr = Tcl_ObjGetVar2(interp, butPtr->textVarNamePtr, NULL,
1701 TCL_GLOBAL_ONLY);
17081702 if (valuePtr == NULL) {
17091703 valuePtr = Tcl_NewObj();
17101704 }
17151709
17161710 if ((butPtr->tkwin != NULL) && Tk_IsMapped(butPtr->tkwin)
17171711 && !(butPtr->flags & REDRAW_PENDING)) {
1718 Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
1712 Tcl_DoWhenIdle(TkpDisplayButton, butPtr);
17191713 butPtr->flags |= REDRAW_PENDING;
17201714 }
17211715 return NULL;
17481742 * <= 0). */
17491743 int imgWidth, int imgHeight)/* New dimensions of image. */
17501744 {
1751 register TkButton *butPtr = (TkButton *) clientData;
1745 register TkButton *butPtr = clientData;
17521746
17531747 if (butPtr->tkwin != NULL) {
17541748 TkpComputeButtonGeometry(butPtr);
17551749 if (Tk_IsMapped(butPtr->tkwin) && !(butPtr->flags & REDRAW_PENDING)) {
1756 Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
1750 Tcl_DoWhenIdle(TkpDisplayButton, butPtr);
17571751 butPtr->flags |= REDRAW_PENDING;
17581752 }
17591753 }
17861780 * <= 0). */
17871781 int imgWidth, int imgHeight)/* New dimensions of image. */
17881782 {
1789 register TkButton *butPtr = (TkButton *) clientData;
1783 register TkButton *butPtr = clientData;
17901784
17911785 /*
17921786 * Don't recompute geometry: it's controlled by the primary image.
17951789 if ((butPtr->flags & SELECTED) && (butPtr->tkwin != NULL)
17961790 && Tk_IsMapped(butPtr->tkwin)
17971791 && !(butPtr->flags & REDRAW_PENDING)) {
1798 Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
1792 Tcl_DoWhenIdle(TkpDisplayButton, butPtr);
17991793 butPtr->flags |= REDRAW_PENDING;
18001794 }
18011795 }
18271821 * <= 0). */
18281822 int imgWidth, int imgHeight)/* New dimensions of image. */
18291823 {
1830 register TkButton *butPtr = (TkButton *) clientData;
1824 register TkButton *butPtr = clientData;
18311825
18321826 /*
18331827 * Don't recompute geometry: it's controlled by the primary image.
18361830 if ((butPtr->flags & TRISTATED) && (butPtr->tkwin != NULL)
18371831 && Tk_IsMapped(butPtr->tkwin)
18381832 && !(butPtr->flags & REDRAW_PENDING)) {
1839 Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) butPtr);
1833 Tcl_DoWhenIdle(TkpDisplayButton, butPtr);
18401834 butPtr->flags |= REDRAW_PENDING;
18411835 }
18421836 }
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkCanvArc.c,v 1.17 2008/04/27 22:38:55 dkf Exp $
11 * RCS: @(#) $Id: tkCanvArc.c,v 1.19 2008/11/22 22:28:52 das Exp $
1212 */
1313
1414 #include <stdio.h>
8282 static int StyleParseProc(ClientData clientData, Tcl_Interp *interp,
8383 Tk_Window tkwin, const char *value,
8484 char *widgRec, int offset);
85 static char * StylePrintProc(ClientData clientData, Tk_Window tkwin,
85 static const char * StylePrintProc(ClientData clientData, Tk_Window tkwin,
8686 char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
8787
88 static Tk_CustomOption stateOption = {
89 (Tk_OptionParseProc *) TkStateParseProc,
90 TkStatePrintProc, (ClientData) 2
88 static const Tk_CustomOption stateOption = {
89 TkStateParseProc, TkStatePrintProc, (ClientData) 2
9190 };
92 static Tk_CustomOption styleOption = {
93 (Tk_OptionParseProc *) StyleParseProc,
94 StylePrintProc, (ClientData) NULL
91 static const Tk_CustomOption styleOption = {
92 StyleParseProc, StylePrintProc, (ClientData) NULL
9593 };
96 static Tk_CustomOption tagsOption = {
97 (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
98 Tk_CanvasTagsPrintProc, (ClientData) NULL
94 static const Tk_CustomOption tagsOption = {
95 Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
9996 };
100 static Tk_CustomOption dashOption = {
101 (Tk_OptionParseProc *) TkCanvasDashParseProc,
102 TkCanvasDashPrintProc, (ClientData) NULL
97 static const Tk_CustomOption dashOption = {
98 TkCanvasDashParseProc, TkCanvasDashPrintProc, (ClientData) NULL
10399 };
104 static Tk_CustomOption offsetOption = {
105 (Tk_OptionParseProc *) TkOffsetParseProc,
106 TkOffsetPrintProc, (ClientData) (TK_OFFSET_RELATIVE)
100 static const Tk_CustomOption offsetOption = {
101 TkOffsetParseProc, TkOffsetPrintProc, (ClientData) (TK_OFFSET_RELATIVE)
107102 };
108 static Tk_CustomOption pixelOption = {
109 (Tk_OptionParseProc *) TkPixelParseProc,
110 TkPixelPrintProc, (ClientData) NULL
103 static const Tk_CustomOption pixelOption = {
104 TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL
111105 };
112106
113107 static Tk_ConfigSpec configSpecs[] = {
241235 NULL, /* dTextProc */
242236 NULL, /* nextPtr */
243237 };
244
245 #ifndef PI
246 #define PI 3.14159265358979323846
247 #endif
248238
249239 /*
250240 *--------------------------------------------------------------
20602050 *--------------------------------------------------------------
20612051 */
20622052
2063 static char *
2053 static const char *
20642054 StylePrintProc(
20652055 ClientData clientData, /* Ignored. */
20662056 Tk_Window tkwin, /* Ignored. */
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkCanvBmap.c,v 1.15 2008/04/27 22:38:55 dkf Exp $
11 * RCS: @(#) $Id: tkCanvBmap.c,v 1.16 2008/11/09 20:51:28 nijtmans Exp $
1212 */
1313
1414 #include <stdio.h>
4242 * Information used for parsing configuration specs:
4343 */
4444
45 static Tk_CustomOption stateOption = {
46 (Tk_OptionParseProc *) TkStateParseProc,
47 TkStatePrintProc, (ClientData) 2
45 static const Tk_CustomOption stateOption = {
46 TkStateParseProc, TkStatePrintProc, (ClientData) 2
4847 };
49 static Tk_CustomOption tagsOption = {
50 (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
51 Tk_CanvasTagsPrintProc, (ClientData) NULL
48 static const Tk_CustomOption tagsOption = {
49 Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
5250 };
5351
5452 static Tk_ConfigSpec configSpecs[] = {
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkCanvImg.c,v 1.12 2008/04/27 22:38:55 dkf Exp $
11 * RCS: @(#) $Id: tkCanvImg.c,v 1.13 2008/11/09 20:51:28 nijtmans Exp $
1212 */
1313
1414 #include <stdio.h>
4545 * Information used for parsing configuration specs:
4646 */
4747
48 static Tk_CustomOption stateOption = {
49 (Tk_OptionParseProc *) TkStateParseProc,
50 TkStatePrintProc, (ClientData) 2
48 static const Tk_CustomOption stateOption = {
49 TkStateParseProc, TkStatePrintProc, (ClientData) 2
5150 };
52 static Tk_CustomOption tagsOption = {
53 (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
54 Tk_CanvasTagsPrintProc, (ClientData) NULL
51 static const Tk_CustomOption tagsOption = {
52 Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
5553 };
5654
5755 static Tk_ConfigSpec configSpecs[] = {
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkCanvLine.c,v 1.23 2008/04/27 22:38:55 dkf Exp $
12 * RCS: @(#) $Id: tkCanvLine.c,v 1.27 2008/11/27 23:26:05 nijtmans Exp $
1313 */
1414
1515 #include <stdio.h>
6060 * point in line (PTS_IN_ARROW points, first
6161 * of which is tip). Malloc'ed. NULL means no
6262 * arrowhead at last point. */
63 Tk_SmoothMethod *smooth; /* Non-zero means draw line smoothed (i.e.
63 const Tk_SmoothMethod *smooth; /* Non-zero means draw line smoothed (i.e.
6464 * with Bezier splines). */
6565 int splineSteps; /* Number of steps in each spline segment. */
6666 } LineItem;
110110 static int ArrowParseProc(ClientData clientData,
111111 Tcl_Interp *interp, Tk_Window tkwin,
112112 const char *value, char *recordPtr, int offset);
113 static char * ArrowPrintProc(ClientData clientData,
113 static const char * ArrowPrintProc(ClientData clientData,
114114 Tk_Window tkwin, char *recordPtr, int offset,
115115 Tcl_FreeProc **freeProcPtr);
116116 static int ParseArrowShape(ClientData clientData,
117117 Tcl_Interp *interp, Tk_Window tkwin,
118118 const char *value, char *recordPtr, int offset);
119 static char * PrintArrowShape(ClientData clientData,
119 static const char * PrintArrowShape(ClientData clientData,
120120 Tk_Window tkwin, char *recordPtr, int offset,
121121 Tcl_FreeProc **freeProcPtr);
122122 static void ScaleLine(Tk_Canvas canvas,
131131 * CreateLine.
132132 */
133133
134 static Tk_CustomOption arrowShapeOption = {
135 (Tk_OptionParseProc *) ParseArrowShape,
136 PrintArrowShape, (ClientData) NULL
134 static const Tk_CustomOption arrowShapeOption = {
135 ParseArrowShape, PrintArrowShape, (ClientData) NULL
137136 };
138 static Tk_CustomOption arrowOption = {
139 (Tk_OptionParseProc *) ArrowParseProc,
140 ArrowPrintProc, (ClientData) NULL
137 static const Tk_CustomOption arrowOption = {
138 ArrowParseProc, ArrowPrintProc, (ClientData) NULL
141139 };
142 static Tk_CustomOption smoothOption = {
143 (Tk_OptionParseProc *) TkSmoothParseProc,
144 TkSmoothPrintProc, (ClientData) NULL
140 static const Tk_CustomOption smoothOption = {
141 TkSmoothParseProc, TkSmoothPrintProc, (ClientData) NULL
145142 };
146 static Tk_CustomOption stateOption = {
147 (Tk_OptionParseProc *) TkStateParseProc,
148 TkStatePrintProc, (ClientData) 2
143 static const Tk_CustomOption stateOption = {
144 TkStateParseProc, TkStatePrintProc, (ClientData) 2
149145 };
150 static Tk_CustomOption tagsOption = {
151 (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
152 Tk_CanvasTagsPrintProc, (ClientData) NULL
146 static const Tk_CustomOption tagsOption = {
147 Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
153148 };
154 static Tk_CustomOption dashOption = {
155 (Tk_OptionParseProc *) TkCanvasDashParseProc,
156 TkCanvasDashPrintProc, (ClientData) NULL
149 static const Tk_CustomOption dashOption = {
150 TkCanvasDashParseProc, TkCanvasDashPrintProc, (ClientData) NULL
157151 };
158 static Tk_CustomOption offsetOption = {
159 (Tk_OptionParseProc *) TkOffsetParseProc,
160 TkOffsetPrintProc,
152 static const Tk_CustomOption offsetOption = {
153 TkOffsetParseProc, TkOffsetPrintProc,
161154 (ClientData) (TK_OFFSET_RELATIVE|TK_OFFSET_INDEX)
162155 };
163 static Tk_CustomOption pixelOption = {
164 (Tk_OptionParseProc *) TkPixelParseProc,
165 TkPixelPrintProc, (ClientData) NULL
156 static const Tk_CustomOption pixelOption = {
157 TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL
166158 };
167159
168160 static Tk_ConfigSpec configSpecs[] = {
177169 "0.0", Tk_Offset(LineItem, outline.activeWidth),
178170 TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
179171 {TK_CONFIG_CUSTOM, "-arrow", NULL, NULL,
180 "none", Tk_Offset(LineItem, arrow), TK_CONFIG_DONT_SET_DEFAULT, &arrowOption},
172 "none", Tk_Offset(LineItem, arrow),
173 TK_CONFIG_DONT_SET_DEFAULT, &arrowOption},
181174 {TK_CONFIG_CUSTOM, "-arrowshape", NULL, NULL,
182175 "8 10 3", Tk_Offset(LineItem, arrowShapeA),
183176 TK_CONFIG_DONT_SET_DEFAULT, &arrowShapeOption},
236229 LineCoords, /* coordProc */
237230 DeleteLine, /* deleteProc */
238231 DisplayLine, /* displayProc */
239 TK_CONFIG_OBJS, /* flags */
232 TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */
240233 LineToPoint, /* pointProc */
241234 LineToArea, /* areaProc */
242235 LineToPostscript, /* postscriptProc */
257250 */
258251
259252 #define MAX_STATIC_POINTS 200
260
253
261254 /*
262255 *--------------------------------------------------------------
263256 *
298291 * proper cleanup after errors during the the remainder of this function.
299292 */
300293
301 Tk_CreateOutline(&(linePtr->outline));
294 Tk_CreateOutline(&linePtr->outline);
302295 linePtr->canvas = canvas;
303296 linePtr->numPoints = 0;
304297 linePtr->coordPtr = NULL;
338331 DeleteLine(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
339332 return TCL_ERROR;
340333 }
341
334
342335 /*
343336 *--------------------------------------------------------------
344337 *
415408 numPoints = objc/2;
416409 if (linePtr->numPoints != numPoints) {
417410 coordPtr = (double *)
418 ckalloc((unsigned) (sizeof(double) * objc));
411 ckalloc(sizeof(double) * (unsigned) objc);
419412 if (linePtr->coordPtr != NULL) {
420413 ckfree((char *) linePtr->coordPtr);
421414 }
423416 linePtr->numPoints = numPoints;
424417 }
425418 coordPtr = linePtr->coordPtr;
426 for (i = 0; i <objc; i++) {
419 for (i = 0; i < objc ; i++) {
427420 if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[i],
428421 coordPtr++) != TCL_OK) {
429422 return TCL_ERROR;
450443 }
451444 return TCL_OK;
452445 }
453
446
454447 /*
455448 *--------------------------------------------------------------
456449 *
499492
500493 state = itemPtr->state;
501494
502 if(state == TK_STATE_NULL) {
495 if (state == TK_STATE_NULL) {
503496 state = Canvas(canvas)->canvas_state;
504497 }
505498
511504 } else {
512505 itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT;
513506 }
514 mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr,
515 &(linePtr->outline));
507 mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &linePtr->outline);
516508 if (mask) {
517509 if (linePtr->arrow == ARROWS_NONE) {
518510 gcValues.cap_style = linePtr->capStyle;
523515 newGC = Tk_GetGC(tkwin, mask, &gcValues);
524516 #ifdef MAC_OSX_TK
525517 /*
526 * Mac OS X CG drawing needs access to linewidth even for
527 * arrow fills (as linewidth controls antialiasing).
518 * Mac OS X CG drawing needs access to linewidth even for arrow fills
519 * (as linewidth controls antialiasing).
528520 */
521
529522 mask |= GCLineWidth;
530523 #else
531524 gcValues.line_width = 0;
553546 linePtr->splineSteps = 100;
554547 }
555548
556 if ((!linePtr->numPoints) || (state==TK_STATE_HIDDEN)) {
549 if ((!linePtr->numPoints) || (state == TK_STATE_HIDDEN)) {
557550 ComputeLineBbox(canvas, linePtr);
558551 return TCL_OK;
559552 }
592585
593586 return TCL_OK;
594587 }
595
588
596589 /*
597590 *--------------------------------------------------------------
598591 *
618611 {
619612 LineItem *linePtr = (LineItem *) itemPtr;
620613
621 Tk_DeleteOutline(display, &(linePtr->outline));
614 Tk_DeleteOutline(display, &linePtr->outline);
622615 if (linePtr->coordPtr != NULL) {
623616 ckfree((char *) linePtr->coordPtr);
624617 }
632625 ckfree((char *) linePtr->lastArrowPtr);
633626 }
634627 }
635
628
636629 /*
637630 *--------------------------------------------------------------
638631 *
661654 Tk_State state = linePtr->header.state;
662655 Tk_TSOffset *tsoffset;
663656
664 if(state == TK_STATE_NULL) {
657 if (state == TK_STATE_NULL) {
665658 state = Canvas(canvas)->canvas_state;
666659 }
667660
668 if (!(linePtr->numPoints) || (state==TK_STATE_HIDDEN)) {
661 if (!(linePtr->numPoints) || (state == TK_STATE_HIDDEN)) {
669662 linePtr->header.x1 = -1;
670663 linePtr->header.x2 = -1;
671664 linePtr->header.y1 = -1;
675668
676669 width = linePtr->outline.width;
677670 if (Canvas(canvas)->currentItemPtr == (Tk_Item *)linePtr) {
678 if (linePtr->outline.activeWidth>width) {
671 if (linePtr->outline.activeWidth > width) {
679672 width = linePtr->outline.activeWidth;
680673 }
681 } else if (state==TK_STATE_DISABLED) {
682 if (linePtr->outline.disabledWidth>0) {
674 } else if (state == TK_STATE_DISABLED) {
675 if (linePtr->outline.disabledWidth > 0) {
683676 width = linePtr->outline.disabledWidth;
684677 }
685678 }
686679
687680 coordPtr = linePtr->coordPtr;
688 linePtr->header.x1 = linePtr->header.x2 = (int) *coordPtr;
681 linePtr->header.x1 = linePtr->header.x2 = (int) coordPtr[0];
689682 linePtr->header.y1 = linePtr->header.y2 = (int) coordPtr[1];
690683
691684 /*
693686 * all directions by the line's width to take care of butting or rounded
694687 * corners and projecting or rounded caps. This expansion is an
695688 * overestimate (worst-case is square root of two over two) but it's
696 * simple. eDon't do anything special for curves. This causes an
697 * additional overestimate in the bounding box, but is faster.
689 * simple. Don't do anything special for curves. This causes an additional
690 * overestimate in the bounding box, but is faster.
698691 */
699692
700693 for (i = 1, coordPtr = linePtr->coordPtr+2; i < linePtr->numPoints;
716709
717710 tsoffset = &linePtr->outline.tsoffset;
718711 if (tsoffset->flags & TK_OFFSET_INDEX) {
719 double *coordPtr = linePtr->coordPtr + (tsoffset->flags & ~TK_OFFSET_INDEX);
712 double *coordPtr = linePtr->coordPtr
713 + (tsoffset->flags & ~TK_OFFSET_INDEX);
714
720715 if (tsoffset->flags <= 0) {
721716 coordPtr = linePtr->coordPtr;
722 if ((linePtr->arrow == ARROWS_FIRST) || (linePtr->arrow == ARROWS_BOTH)) {
717 if ((linePtr->arrow == ARROWS_FIRST)
718 || (linePtr->arrow == ARROWS_BOTH)) {
723719 coordPtr = linePtr->firstArrowPtr;
724720 }
725721 }
726722 if (tsoffset->flags > (linePtr->numPoints * 2)) {
727723 coordPtr = linePtr->coordPtr + (linePtr->numPoints * 2);
728 if ((linePtr->arrow == ARROWS_LAST) || (linePtr->arrow == ARROWS_BOTH)) {
724 if ((linePtr->arrow == ARROWS_LAST)
725 || (linePtr->arrow == ARROWS_BOTH)) {
729726 coordPtr = linePtr->lastArrowPtr;
730727 }
731728 }
754751 linePtr->header.y1 -= intWidth;
755752 linePtr->header.y2 += intWidth;
756753
757 if (linePtr->numPoints==1) {
754 if (linePtr->numPoints == 1) {
758755 linePtr->header.x1 -= 1;
759756 linePtr->header.x2 += 1;
760757 linePtr->header.y1 -= 1;
812809 linePtr->header.y1 -= 1;
813810 linePtr->header.y2 += 1;
814811 }
815
812
816813 /*
817814 *--------------------------------------------------------------
818815 *
847844 int numPoints;
848845 Tk_State state = itemPtr->state;
849846
850 if ((!linePtr->numPoints)||(linePtr->outline.gc==None)) {
847 if ((!linePtr->numPoints) || (linePtr->outline.gc == None)) {
851848 return;
852849 }
853850
859856 if (linePtr->outline.activeWidth != linewidth) {
860857 linewidth = linePtr->outline.activeWidth;
861858 }
862 } else if (state==TK_STATE_DISABLED) {
859 } else if (state == TK_STATE_DISABLED) {
863860 if (linePtr->outline.disabledWidth != linewidth) {
864861 linewidth = linePtr->outline.disabledWidth;
865862 }
881878 if (numPoints <= MAX_STATIC_POINTS) {
882879 pointPtr = staticPoints;
883880 } else {
884 pointPtr = (XPoint *)ckalloc((unsigned)(numPoints * 3*sizeof(XPoint)));
881 pointPtr = (XPoint *)
882 ckalloc((unsigned) numPoints * 3 * sizeof(XPoint));
885883 }
886884
887885 if ((linePtr->smooth) && (linePtr->numPoints > 2)) {
888886 numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
889887 linePtr->numPoints, linePtr->splineSteps, pointPtr, NULL);
890888 } else {
891 numPoints = TkCanvTranslatePath((TkCanvas*)canvas, numPoints,
889 numPoints = TkCanvTranslatePath((TkCanvas *) canvas, numPoints,
892890 linePtr->coordPtr, 0, pointPtr);
893891 }
894892
899897 * read-only.
900898 */
901899
902 if (Tk_ChangeOutlineGC(canvas, itemPtr, &(linePtr->outline))) {
903 Tk_CanvasSetOffset(canvas, linePtr->arrowGC, &linePtr->outline.tsoffset);
904 }
905 if (numPoints>1) {
900 if (Tk_ChangeOutlineGC(canvas, itemPtr, &linePtr->outline)) {
901 Tk_CanvasSetOffset(canvas, linePtr->arrowGC,
902 &linePtr->outline.tsoffset);
903 }
904 if (numPoints > 1) {
906905 XDrawLines(display, drawable, linePtr->outline.gc, pointPtr, numPoints,
907 CoordModeOrigin);
906 CoordModeOrigin);
908907 } else {
909908 int intwidth = (int) (linewidth + 0.5);
910 if (intwidth<1) {
911 intwidth=1;
909
910 if (intwidth < 1) {
911 intwidth = 1;
912912 }
913913 XFillArc(display, drawable, linePtr->outline.gc,
914914 pointPtr->x - intwidth/2, pointPtr->y - intwidth/2,
915 (unsigned int)intwidth+1, (unsigned int)intwidth+1, 0, 64*360);
915 (unsigned) intwidth+1, (unsigned) intwidth+1, 0, 64*360);
916916 }
917917 if (pointPtr != staticPoints) {
918918 ckfree((char *) pointPtr);
930930 TkFillPolygon(canvas, linePtr->lastArrowPtr, PTS_IN_ARROW,
931931 display, drawable, linePtr->arrowGC, NULL);
932932 }
933 if (Tk_ResetOutlineGC(canvas, itemPtr, &(linePtr->outline))) {
933 if (Tk_ResetOutlineGC(canvas, itemPtr, &linePtr->outline)) {
934934 XSetTSOrigin(display, linePtr->arrowGC, 0, 0);
935935 }
936936 }
937
937
938938 /*
939939 *--------------------------------------------------------------
940940 *
10061006 newCoordPtr[i+objc] = linePtr->coordPtr[i];
10071007 }
10081008 if (linePtr->coordPtr) {
1009 ckfree((char *)linePtr->coordPtr);
1009 ckfree((char *) linePtr->coordPtr);
10101010 }
10111011 linePtr->coordPtr = newCoordPtr;
10121012 linePtr->numPoints = (length + objc)/2;
10131013
1014 if ((length>3) && (state != TK_STATE_HIDDEN)) {
1014 if ((length > 3) && (state != TK_STATE_HIDDEN)) {
10151015 /*
10161016 * This is some optimizing code that will result that only the part of
10171017 * the polygon that changed (and the objects that are overlapping with
10231023
10241024 itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
10251025
1026 if (beforeThis>0) {beforeThis -= 2; objc+=2; }
1027 if ((beforeThis+objc)<length) objc+=2;
1026 if (beforeThis > 0) {
1027 beforeThis -= 2;
1028 objc += 2;
1029 }
1030 if (beforeThis+objc < length) {
1031 objc += 2;
1032 }
10281033 if (linePtr->smooth) {
1029 if(beforeThis>0) {
1030 beforeThis-=2; objc+=2;
1031 }
1032 if((beforeThis+objc+2)<length) {
1033 objc+=2;
1034 if (beforeThis > 0) {
1035 beforeThis -= 2;
1036 objc += 2;
1037 }
1038 if (beforeThis+objc+2 < length) {
1039 objc += 2;
10341040 }
10351041 }
10361042 itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[beforeThis];
10371043 itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[beforeThis+1];
1038 if ((linePtr->firstArrowPtr != NULL) && (beforeThis<1)) {
1044 if ((linePtr->firstArrowPtr != NULL) && (beforeThis < 1)) {
10391045 /*
10401046 * Include old first arrow.
10411047 */
10451051 TkIncludePoint(itemPtr, coordPtr);
10461052 }
10471053 }
1048 if ((linePtr->lastArrowPtr != NULL) && ((beforeThis+objc)>=length)) {
1054 if ((linePtr->lastArrowPtr != NULL) && (beforeThis+objc >= length)) {
10491055 /*
10501056 * Include old last arrow.
10511057 */
10551061 TkIncludePoint(itemPtr, coordPtr);
10561062 }
10571063 }
1058 coordPtr = linePtr->coordPtr+beforeThis+2;
1064 coordPtr = linePtr->coordPtr + beforeThis + 2;
10591065 for (i=2; i<objc; i+=2) {
10601066 TkIncludePoint(itemPtr, coordPtr);
1061 coordPtr+=2;
1067 coordPtr += 2;
10621068 }
10631069 }
10641070 if (linePtr->firstArrowPtr != NULL) {
10771083 double width;
10781084 int intWidth;
10791085
1080 if ((linePtr->firstArrowPtr != NULL) && (beforeThis>2)) {
1086 if ((linePtr->firstArrowPtr != NULL) && (beforeThis > 2)) {
10811087 /*
10821088 * Include new first arrow.
10831089 */
10991105 }
11001106 width = linePtr->outline.width;
11011107 if (Canvas(canvas)->currentItemPtr == itemPtr) {
1102 if (linePtr->outline.activeWidth>width) {
1108 if (linePtr->outline.activeWidth > width) {
11031109 width = linePtr->outline.activeWidth;
11041110 }
1105 } else if (state==TK_STATE_DISABLED) {
1106 if (linePtr->outline.disabledWidth>0) {
1111 } else if (state == TK_STATE_DISABLED) {
1112 if (linePtr->outline.disabledWidth > 0) {
11071113 width = linePtr->outline.disabledWidth;
11081114 }
11091115 }
11111117 if (intWidth < 1) {
11121118 intWidth = 1;
11131119 }
1114 itemPtr->x1 -= intWidth; itemPtr->y1 -= intWidth;
1115 itemPtr->x2 += intWidth; itemPtr->y2 += intWidth;
1120 itemPtr->x1 -= intWidth;
1121 itemPtr->y1 -= intWidth;
1122 itemPtr->x2 += intWidth;
1123 itemPtr->y2 += intWidth;
11161124 Tk_CanvasEventuallyRedraw(canvas, itemPtr->x1, itemPtr->y1,
11171125 itemPtr->x2, itemPtr->y2);
11181126 }
11191127
11201128 ComputeLineBbox(canvas, linePtr);
11211129 }
1122
1130
11231131 /*
11241132 *--------------------------------------------------------------
11251133 *
11501158 double *coordPtr;
11511159 Tk_State state = itemPtr->state;
11521160
1153 if(state == TK_STATE_NULL) {
1161 if (state == TK_STATE_NULL) {
11541162 state = Canvas(canvas)->canvas_state;
11551163 }
11561164
11741182 linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0];
11751183 linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1];
11761184 }
1177 first1 = first; last1 = last;
1178 if(first1>0) first1 -= 2;
1179 if(last1<length-2) last1 += 2;
1185 first1 = first;
1186 last1 = last;
1187 if (first1 > 0) {
1188 first1 -= 2;
1189 }
1190 if (last1 < length-2) {
1191 last1 += 2;
1192 }
11801193 if (linePtr->smooth) {
1181 if(first1>0) first1 -= 2;
1182 if(last1<length-2) last1 += 2;
1183 }
1184
1185 if((first1<2) && (last1 >= length-2)) {
1194 if (first1 > 0) {
1195 first1 -= 2;
1196 }
1197 if (last1 < length-2) {
1198 last1 += 2;
1199 }
1200 }
1201
1202 if ((first1 < 2) && (last1 >= length-2)) {
11861203 /*
11871204 * This is some optimizing code that will result that only the part of
11881205 * the line that changed (and the objects that are overlapping with
11951212 itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
11961213 itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[first1];
11971214 itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[first1+1];
1198 if ((linePtr->firstArrowPtr != NULL) && (first1<2)) {
1215 if ((linePtr->firstArrowPtr != NULL) && (first1 < 2)) {
11991216 /*
12001217 * Include old first arrow.
12011218 */
12051222 TkIncludePoint(itemPtr, coordPtr);
12061223 }
12071224 }
1208 if ((linePtr->lastArrowPtr != NULL) && (last1>=length-2)) {
1225 if ((linePtr->lastArrowPtr != NULL) && (last1 >= length-2)) {
12091226 /*
12101227 * Include old last arrow.
12111228 */
12181235 coordPtr = linePtr->coordPtr+first1+2;
12191236 for (i=first1+2; i<=last1; i+=2) {
12201237 TkIncludePoint(itemPtr, coordPtr);
1221 coordPtr+=2;
1238 coordPtr += 2;
12221239 }
12231240 }
12241241
12361253 linePtr->lastArrowPtr = NULL;
12371254 }
12381255 if (linePtr->arrow != ARROWS_NONE) {
1239 ConfigureArrows(canvas, linePtr);
1240 }
1241 if(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
1256 ConfigureArrows(canvas, linePtr);
1257 }
1258 if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
12421259 double width;
12431260 int intWidth;
12441261
1245 if ((linePtr->firstArrowPtr != NULL) && (first1<4)) {
1262 if ((linePtr->firstArrowPtr != NULL) && (first1 < 4)) {
12461263 /*
12471264 * Include new first arrow.
12481265 */
12521269 TkIncludePoint(itemPtr, coordPtr);
12531270 }
12541271 }
1255 if ((linePtr->lastArrowPtr != NULL) && (last1>(length-4))) {
1272 if ((linePtr->lastArrowPtr != NULL) && (last1 > length-4)) {
12561273 /*
12571274 * Include new right arrow.
12581275 */
12641281 }
12651282 width = linePtr->outline.width;
12661283 if (Canvas(canvas)->currentItemPtr == itemPtr) {
1267 if (linePtr->outline.activeWidth>width) {
1268 width = linePtr->outline.activeWidth;
1269 }
1270 } else if (state==TK_STATE_DISABLED) {
1271 if (linePtr->outline.disabledWidth>0) {
1272 width = linePtr->outline.disabledWidth;
1273 }
1284 if (linePtr->outline.activeWidth > width) {
1285 width = linePtr->outline.activeWidth;
1286 }
1287 } else if (state == TK_STATE_DISABLED) {
1288 if (linePtr->outline.disabledWidth > 0) {
1289 width = linePtr->outline.disabledWidth;
1290 }
12741291 }
12751292 intWidth = (int) (width + 0.5);
12761293 if (intWidth < 1) {
12771294 intWidth = 1;
12781295 }
1279 itemPtr->x1 -= intWidth; itemPtr->y1 -= intWidth;
1280 itemPtr->x2 += intWidth; itemPtr->y2 += intWidth;
1296 itemPtr->x1 -= intWidth;
1297 itemPtr->y1 -= intWidth;
1298 itemPtr->x2 += intWidth;
1299 itemPtr->y2 += intWidth;
12811300 Tk_CanvasEventuallyRedraw(canvas, itemPtr->x1, itemPtr->y1,
12821301 itemPtr->x2, itemPtr->y2);
12831302 }
12841303 ComputeLineBbox(canvas, linePtr);
12851304 }
1286
1305
12871306 /*
12881307 *--------------------------------------------------------------
12891308 *
13291348 * which to do the check.
13301349 */
13311350
1332 if(state == TK_STATE_NULL) {
1351 if (state == TK_STATE_NULL) {
13331352 state = Canvas(canvas)->canvas_state;
13341353 }
13351354
13361355 width = linePtr->outline.width;
13371356 if (Canvas(canvas)->currentItemPtr == itemPtr) {
1338 if (linePtr->outline.activeWidth>width) {
1357 if (linePtr->outline.activeWidth > width) {
13391358 width = linePtr->outline.activeWidth;
13401359 }
1341 } else if (state==TK_STATE_DISABLED) {
1342 if (linePtr->outline.disabledWidth>0) {
1360 } else if (state == TK_STATE_DISABLED) {
1361 if (linePtr->outline.disabledWidth > 0) {
13431362 width = linePtr->outline.disabledWidth;
13441363 }
13451364 }
13501369 if (numPoints <= MAX_STATIC_POINTS) {
13511370 linePoints = staticSpace;
13521371 } else {
1353 linePoints = (double *) ckalloc((unsigned)
1354 (2*numPoints*sizeof(double)));
1372 linePoints = (double *)
1373 ckalloc((unsigned) (2*numPoints*sizeof(double)));
13551374 }
13561375 numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
13571376 linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
13641383 width = 1.0;
13651384 }
13661385
1367 if (!numPoints || itemPtr->state==TK_STATE_HIDDEN) {
1386 if (!numPoints || itemPtr->state == TK_STATE_HIDDEN) {
13681387 return bestDist;
13691388 } else if (numPoints == 1) {
13701389 bestDist = hypot(linePoints[0]-pointPtr[0], linePoints[1]-pointPtr[1])
13711390 - width/2.0;
1372 if (bestDist < 0) bestDist = 0;
1391 if (bestDist < 0) {
1392 bestDist = 0;
1393 }
13731394 return bestDist;
13741395 }
13751396
15121533 }
15131534 return bestDist;
15141535 }
1515
1536
15161537 /*
15171538 *--------------------------------------------------------------
15181539 *
15451566 double radius, width;
15461567 Tk_State state = itemPtr->state;
15471568
1548 if(state == TK_STATE_NULL) {
1569 if (state == TK_STATE_NULL) {
15491570 state = Canvas(canvas)->canvas_state;
15501571 }
15511572 width = linePtr->outline.width;
15521573 if (Canvas(canvas)->currentItemPtr == itemPtr) {
1553 if (linePtr->outline.activeWidth>width) {
1574 if (linePtr->outline.activeWidth > width) {
15541575 width = linePtr->outline.activeWidth;
15551576 }
1556 } else if (state==TK_STATE_DISABLED) {
1557 if (linePtr->outline.disabledWidth>0) {
1577 } else if (state == TK_STATE_DISABLED) {
1578 if (linePtr->outline.disabledWidth > 0) {
15581579 width = linePtr->outline.disabledWidth;
15591580 }
15601581 }
15611582
15621583 radius = (width+1.0)/2.0;
15631584
1564 if ((state==TK_STATE_HIDDEN) || !linePtr->numPoints) {
1585 if ((state == TK_STATE_HIDDEN) || !linePtr->numPoints) {
15651586 return -1;
15661587 } else if (linePtr->numPoints == 1) {
15671588 double oval[4];
15841605 if (numPoints <= MAX_STATIC_POINTS) {
15851606 linePoints = staticSpace;
15861607 } else {
1587 linePoints = (double *) ckalloc((unsigned)
1588 (2*numPoints*sizeof(double)));
1608 linePoints = (double *)
1609 ckalloc((unsigned) (2*numPoints*sizeof(double)));
15891610 }
15901611 numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
15911612 linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
15981619 * Check the segments of the line.
15991620 */
16001621
1601 if (width < 1.0) {
1622 if (width < 1.0) {
16021623 width = 1.0;
16031624 }
16041625
1605 result = TkThickPolyLineToArea(linePoints, numPoints,
1606 width, linePtr->capStyle, linePtr->joinStyle,
1607 rectPtr);
1626 result = TkThickPolyLineToArea(linePoints, numPoints, width,
1627 linePtr->capStyle, linePtr->joinStyle, rectPtr);
16081628 if (result == 0) {
16091629 goto done;
16101630 }
16361656 }
16371657 return result;
16381658 }
1639
1659
16401660 /*
16411661 *--------------------------------------------------------------
16421662 *
16991719 }
17001720 ComputeLineBbox(canvas, linePtr);
17011721 }
1702
1722
17031723 /*
17041724 *--------------------------------------------------------------
17051725 *
17431763 */
17441764
17451765 badIndex:
1746 Tcl_SetResult(interp, NULL, TCL_STATIC);
1766 Tcl_ResetResult(interp);
17471767 Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL);
17481768 return TCL_ERROR;
17491769 }
17501770 } else if (string[0] == '@') {
17511771 int i;
1752 double x ,y, bestDist, dist, *coordPtr;
1772 double x, y, bestDist, dist, *coordPtr;
17531773 char *end, *p;
17541774
17551775 p = string+1;
17651785 bestDist = 1.0e36;
17661786 coordPtr = linePtr->coordPtr;
17671787 *indexPtr = 0;
1768 for(i=0; i<linePtr->numPoints; i++) {
1788 for (i=0; i<linePtr->numPoints; i++) {
17691789 dist = hypot(coordPtr[0] - x, coordPtr[1] - y);
1770 if (dist<bestDist) {
1790 if (dist < bestDist) {
17711791 bestDist = dist;
17721792 *indexPtr = 2*i;
17731793 }
17771797 if (Tcl_GetIntFromObj(interp, obj, indexPtr) != TCL_OK) {
17781798 goto badIndex;
17791799 }
1780 *indexPtr &= -2; /* if index is odd, make it even */
1800 *indexPtr &= -2; /* If index is odd, make it even. */
17811801 if (*indexPtr < 0){
17821802 *indexPtr = 0;
17831803 } else if (*indexPtr > (2*linePtr->numPoints)) {
17861806 }
17871807 return TCL_OK;
17881808 }
1789
1809
17901810 /*
17911811 *--------------------------------------------------------------
17921812 *
18361856 }
18371857 ComputeLineBbox(canvas, linePtr);
18381858 }
1839
1859
18401860 /*
18411861 *--------------------------------------------------------------
18421862 *
19031923 ckfree((char *) argv);
19041924 return TCL_OK;
19051925 }
1906
1926
19071927 /*
19081928 *--------------------------------------------------------------
19091929 *
19221942 */
19231943
19241944 /* ARGSUSED */
1925 static char *
1945 static const char *
19261946 PrintArrowShape(
19271947 ClientData clientData, /* Not used. */
19281948 Tk_Window tkwin, /* Window associated with linePtr's widget. */
19331953 * string here. */
19341954 {
19351955 LineItem *linePtr = (LineItem *) recordPtr;
1936 char *buffer;
1937
1938 buffer = (char *) ckalloc(120);
1956 char *buffer = ckalloc(120);
1957
19391958 sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA,
19401959 linePtr->arrowShapeB, linePtr->arrowShapeC);
19411960 *freeProcPtr = TCL_DYNAMIC;
19421961 return buffer;
19431962 }
1944
1945
1963
19461964 /*
19471965 *--------------------------------------------------------------
19481966 *
19751993
19761994 register Arrows *arrowPtr = (Arrows *) (widgRec + offset);
19771995
1978 if(value == NULL || *value == 0) {
1996 if (value == NULL || *value == 0) {
19791997 *arrowPtr = ARROWS_NONE;
19801998 return TCL_OK;
19811999 }
20052023 *arrowPtr = ARROWS_NONE;
20062024 return TCL_ERROR;
20072025 }
2008
2026
20092027 /*
20102028 *--------------------------------------------------------------
20112029 *
20272045 *--------------------------------------------------------------
20282046 */
20292047
2030 static char *
2048 static const char *
20312049 ArrowPrintProc(
20322050 ClientData clientData, /* Ignored. */
20332051 Tk_Window tkwin, /* Window containing canvas widget. */
20502068 return "none";
20512069 }
20522070 }
2053
2071
20542072 /*
20552073 *--------------------------------------------------------------
20562074 *
20912109 double width;
20922110 Tk_State state = linePtr->header.state;
20932111
2094 if (linePtr->numPoints <2) {
2112 if (linePtr->numPoints < 2) {
20952113 return TCL_OK;
20962114 }
20972115
2098 if(state == TK_STATE_NULL) {
2116 if (state == TK_STATE_NULL) {
20992117 state = Canvas(canvas)->canvas_state;
21002118 }
21012119
21022120 width = linePtr->outline.width;
21032121 if (Canvas(canvas)->currentItemPtr == (Tk_Item *)linePtr) {
2104 if (linePtr->outline.activeWidth>width) {
2122 if (linePtr->outline.activeWidth > width) {
21052123 width = linePtr->outline.activeWidth;
21062124 }
2107 } else if (state==TK_STATE_DISABLED) {
2108 if (linePtr->outline.disabledWidth>0) {
2125 } else if (state == TK_STATE_DISABLED) {
2126 if (linePtr->outline.disabledWidth > 0) {
21092127 width = linePtr->outline.disabledWidth;
21102128 }
21112129 }
21322150 if (linePtr->arrow != ARROWS_LAST) {
21332151 poly = linePtr->firstArrowPtr;
21342152 if (poly == NULL) {
2135 poly = (double *) ckalloc((unsigned)
2136 (2*PTS_IN_ARROW*sizeof(double)));
2153 poly = (double *)
2154 ckalloc((unsigned) (2*PTS_IN_ARROW*sizeof(double)));
21372155 poly[0] = poly[10] = linePtr->coordPtr[0];
21382156 poly[1] = poly[11] = linePtr->coordPtr[1];
21392157 linePtr->firstArrowPtr = poly;
22102228
22112229 return TCL_OK;
22122230 }
2213
2231
22142232 /*
22152233 *--------------------------------------------------------------
22162234 *
22412259 {
22422260 LineItem *linePtr = (LineItem *) itemPtr;
22432261 char buffer[64 + TCL_INTEGER_SPACE];
2244 char *style;
2262 const char *style;
22452263
22462264 double width;
22472265 XColor *color;
22482266 Pixmap stipple;
22492267 Tk_State state = itemPtr->state;
22502268
2251 if(state == TK_STATE_NULL) {
2269 if (state == TK_STATE_NULL) {
22522270 state = Canvas(canvas)->canvas_state;
22532271 }
22542272
22562274 color = linePtr->outline.color;
22572275 stipple = linePtr->outline.stipple;
22582276 if (Canvas(canvas)->currentItemPtr == itemPtr) {
2259 if (linePtr->outline.activeWidth>width) {
2277 if (linePtr->outline.activeWidth > width) {
22602278 width = linePtr->outline.activeWidth;
22612279 }
2262 if (linePtr->outline.activeColor!=NULL) {
2280 if (linePtr->outline.activeColor != NULL) {
22632281 color = linePtr->outline.activeColor;
22642282 }
2265 if (linePtr->outline.activeStipple!=None) {
2283 if (linePtr->outline.activeStipple != None) {
22662284 stipple = linePtr->outline.activeStipple;
22672285 }
2268 } else if (state==TK_STATE_DISABLED) {
2269 if (linePtr->outline.disabledWidth>0) {
2286 } else if (state == TK_STATE_DISABLED) {
2287 if (linePtr->outline.disabledWidth > 0) {
22702288 width = linePtr->outline.disabledWidth;
22712289 }
2272 if (linePtr->outline.disabledColor!=NULL) {
2290 if (linePtr->outline.disabledColor != NULL) {
22732291 color = linePtr->outline.disabledColor;
22742292 }
2275 if (linePtr->outline.disabledStipple!=None) {
2293 if (linePtr->outline.disabledStipple != None) {
22762294 stipple = linePtr->outline.disabledStipple;
22772295 }
22782296 }
22792297
2280 if (color == NULL || linePtr->numPoints<1 || linePtr->coordPtr==NULL) {
2298 if (color == NULL || linePtr->numPoints < 1 || linePtr->coordPtr == NULL){
22812299 return TCL_OK;
22822300 }
22832301
2284 if (linePtr->numPoints==1) {
2302 if (linePtr->numPoints == 1) {
22852303 sprintf(buffer, "%.15g %.15g translate %.15g %.15g",
22862304 linePtr->coordPtr[0], Tk_CanvasPsY(canvas, linePtr->coordPtr[1]),
22872305 width/2.0, width/2.0);
2288 Tcl_AppendResult(interp, "matrix currentmatrix\n",buffer,
2306 Tcl_AppendResult(interp, "matrix currentmatrix\n", buffer,
22892307 " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", NULL);
22902308 if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
22912309 return TCL_ERROR;
23072325
23082326 if ((!linePtr->smooth) || (linePtr->numPoints < 3)) {
23092327 Tk_CanvasPsPath(interp, canvas, linePtr->coordPtr, linePtr->numPoints);
2328 } else if ((stipple == None) && linePtr->smooth->postscriptProc) {
2329 linePtr->smooth->postscriptProc(interp, canvas, linePtr->coordPtr,
2330 linePtr->numPoints, linePtr->splineSteps);
23102331 } else {
2311 if ((stipple == None) && linePtr->smooth->postscriptProc) {
2312 linePtr->smooth->postscriptProc(interp, canvas,
2313 linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps);
2314 } else {
2315 /*
2316 * Special hack: Postscript printers don't appear to be able to
2317 * turn a path drawn with "curveto"s into a clipping path without
2318 * exceeding resource limits, so TkMakeBezierPostscript won't work
2319 * for stippled curves. Instead, generate all of the intermediate
2320 * points here and output them into the Postscript file with
2321 * "lineto"s instead.
2322 */
2323
2324 double staticPoints[2*MAX_STATIC_POINTS];
2325 double *pointPtr;
2326 int numPoints;
2327
2328 numPoints = linePtr->smooth->coordProc(canvas, NULL,
2329 linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
2330 pointPtr = staticPoints;
2331 if (numPoints > MAX_STATIC_POINTS) {
2332 pointPtr = (double *) ckalloc((unsigned)
2333 (numPoints * 2 * sizeof(double)));
2334 }
2335 numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
2336 linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr);
2337 Tk_CanvasPsPath(interp, canvas, pointPtr, numPoints);
2338 if (pointPtr != staticPoints) {
2339 ckfree((char *) pointPtr);
2340 }
2332 /*
2333 * Special hack: Postscript printers don't appear to be able to turn a
2334 * path drawn with "curveto"s into a clipping path without exceeding
2335 * resource limits, so TkMakeBezierPostscript won't work for stippled
2336 * curves. Instead, generate all of the intermediate points here and
2337 * output them into the Postscript file with "lineto"s instead.
2338 */
2339
2340 double staticPoints[2*MAX_STATIC_POINTS];
2341 double *pointPtr;
2342 int numPoints;
2343
2344 numPoints = linePtr->smooth->coordProc(canvas, NULL,
2345 linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
2346 pointPtr = staticPoints;
2347 if (numPoints > MAX_STATIC_POINTS) {
2348 pointPtr = (double *)
2349 ckalloc((unsigned) (numPoints * 2 * sizeof(double)));
2350 }
2351 numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
2352 linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr);
2353 Tk_CanvasPsPath(interp, canvas, pointPtr, numPoints);
2354 if (pointPtr != staticPoints) {
2355 ckfree((char *) pointPtr);
23412356 }
23422357 }
23432358
23602375 }
23612376 Tcl_AppendResult(interp, style, NULL);
23622377
2363 if (Tk_CanvasPsOutline(canvas, itemPtr, &(linePtr->outline)) != TCL_OK) {
2378 if (Tk_CanvasPsOutline(canvas, itemPtr, &linePtr->outline) != TCL_OK) {
23642379 return TCL_ERROR;
23652380 }
23662381
23882403 }
23892404 return TCL_OK;
23902405 }
2391
2406
23922407 /*
23932408 *--------------------------------------------------------------
23942409 *
24302445 if (linePtr->outline.activeStipple!=None) {
24312446 stipple = linePtr->outline.activeStipple;
24322447 }
2433 } else if (state==TK_STATE_DISABLED) {
2448 } else if (state == TK_STATE_DISABLED) {
24342449 if (linePtr->outline.activeStipple!=None) {
24352450 stipple = linePtr->outline.disabledStipple;
24362451 }
24472462 }
24482463 return TCL_OK;
24492464 }
2450
2465
24512466 /*
24522467 * Local Variables:
24532468 * mode: c
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkCanvPoly.c,v 1.19 2008/04/27 22:38:55 dkf Exp $
12 * RCS: @(#) $Id: tkCanvPoly.c,v 1.23 2008/11/09 21:53:39 nijtmans Exp $
1313 */
1414
1515 #include <stdio.h>
4545 Pixmap disabledFillStipple; /* Stipple bitmap for filling polygon if state
4646 * is disabled. */
4747 GC fillGC; /* Graphics context for filling polygon. */
48 Tk_SmoothMethod *smooth; /* Non-zero means draw shape smoothed (i.e.
48 const Tk_SmoothMethod *smooth; /* Non-zero means draw shape smoothed (i.e.
4949 * with Bezier splines). */
5050 int splineSteps; /* Number of steps in each spline segment. */
5151 int autoClosed; /* Zero means the given polygon was closed,
5656 * Information used for parsing configuration specs:
5757 */
5858
59 static Tk_CustomOption smoothOption = {
60 (Tk_OptionParseProc *) TkSmoothParseProc,
61 TkSmoothPrintProc, (ClientData) NULL
59 static const Tk_CustomOption smoothOption = {
60 TkSmoothParseProc, TkSmoothPrintProc, (ClientData) NULL
6261 };
63 static Tk_CustomOption stateOption = {
64 (Tk_OptionParseProc *) TkStateParseProc,
65 TkStatePrintProc, (ClientData) 2
62 static const Tk_CustomOption stateOption = {
63 TkStateParseProc, TkStatePrintProc, (ClientData) 2
6664 };
67 static Tk_CustomOption tagsOption = {
68 (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
69 Tk_CanvasTagsPrintProc, (ClientData) NULL
65 static const Tk_CustomOption tagsOption = {
66 Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
7067 };
71 static Tk_CustomOption dashOption = {
72 (Tk_OptionParseProc *) TkCanvasDashParseProc,
73 TkCanvasDashPrintProc, (ClientData) NULL
68 static const Tk_CustomOption dashOption = {
69 TkCanvasDashParseProc, TkCanvasDashPrintProc, (ClientData) NULL
7470 };
75 static Tk_CustomOption offsetOption = {
76 (Tk_OptionParseProc *) TkOffsetParseProc,
77 TkOffsetPrintProc,
71 static const Tk_CustomOption offsetOption = {
72 TkOffsetParseProc, TkOffsetPrintProc,
7873 (ClientData) (TK_OFFSET_RELATIVE|TK_OFFSET_INDEX)
7974 };
80 static Tk_CustomOption pixelOption = {
81 (Tk_OptionParseProc *) TkPixelParseProc,
82 TkPixelPrintProc, (ClientData) NULL
75 static const Tk_CustomOption pixelOption = {
76 TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL
8377 };
8478
8579 static Tk_ConfigSpec configSpecs[] = {
204198 PolygonCoords, /* coordProc */
205199 DeletePolygon, /* deleteProc */
206200 DisplayPolygon, /* displayProc */
207 TK_CONFIG_OBJS, /* flags */
201 TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */
208202 PolygonToPoint, /* pointProc */
209203 PolygonToArea, /* areaProc */
210204 PolygonToPostscript, /* postscriptProc */
266260 * errors during the the remainder of this function.
267261 */
268262
269 Tk_CreateOutline(&(polyPtr->outline));
263 Tk_CreateOutline(&polyPtr->outline);
270264 polyPtr->numPoints = 0;
271265 polyPtr->pointsAllocated = 0;
272266 polyPtr->coordPtr = NULL;
293287
294288 for (i = 0; i < objc; i++) {
295289 char *arg = Tcl_GetString(objv[i]);
290
296291 if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
297292 break;
298293 }
362357 }
363358 }
364359 if (objc & 1) {
365 char buf[64 + TCL_INTEGER_SPACE];
366
367 sprintf(buf, "wrong # coordinates: expected an even number, got %d",
368 objc);
369 Tcl_SetResult(interp, buf, TCL_VOLATILE);
360 Tcl_SetObjResult(interp, Tcl_ObjPrintf(
361 "wrong # coordinates: expected an even number, got %d",
362 objc));
370363 return TCL_ERROR;
371 } else {
372 numPoints = objc/2;
373 if (polyPtr->pointsAllocated <= numPoints) {
374 if (polyPtr->coordPtr != NULL) {
375 ckfree((char *) polyPtr->coordPtr);
376 }
377
378 /*
379 * One extra point gets allocated here, because we always add
380 * another point to close the polygon.
381 */
382
383 polyPtr->coordPtr = (double *) ckalloc((unsigned)
384 (sizeof(double) * (objc+2)));
385 polyPtr->pointsAllocated = numPoints+1;
386 }
387 for (i = objc-1; i >= 0; i--) {
388 if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[i],
389 &polyPtr->coordPtr[i]) != TCL_OK) {
390 return TCL_ERROR;
391 }
392 }
393 polyPtr->numPoints = numPoints;
394 polyPtr->autoClosed = 0;
364 }
365
366 numPoints = objc/2;
367 if (polyPtr->pointsAllocated <= numPoints) {
368 if (polyPtr->coordPtr != NULL) {
369 ckfree((char *) polyPtr->coordPtr);
370 }
395371
396372 /*
397 * Close the polygon if it isn't already closed.
373 * One extra point gets allocated here, because we always add
374 * another point to close the polygon.
398375 */
399376
400 if (objc>2 && ((polyPtr->coordPtr[objc-2] != polyPtr->coordPtr[0])
401 || (polyPtr->coordPtr[objc-1] != polyPtr->coordPtr[1]))) {
402 polyPtr->autoClosed = 1;
403 polyPtr->numPoints++;
404 polyPtr->coordPtr[objc] = polyPtr->coordPtr[0];
405 polyPtr->coordPtr[objc+1] = polyPtr->coordPtr[1];
406 }
407 ComputePolygonBbox(canvas, polyPtr);
408 }
377 polyPtr->coordPtr = (double *)
378 ckalloc(sizeof(double) * (unsigned)(objc+2));
379 polyPtr->pointsAllocated = numPoints+1;
380 }
381 for (i = objc-1; i >= 0; i--) {
382 if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[i],
383 &polyPtr->coordPtr[i]) != TCL_OK) {
384 return TCL_ERROR;
385 }
386 }
387 polyPtr->numPoints = numPoints;
388 polyPtr->autoClosed = 0;
389
390 /*
391 * Close the polygon if it isn't already closed.
392 */
393
394 if (objc>2 && ((polyPtr->coordPtr[objc-2] != polyPtr->coordPtr[0])
395 || (polyPtr->coordPtr[objc-1] != polyPtr->coordPtr[1]))) {
396 polyPtr->autoClosed = 1;
397 polyPtr->numPoints++;
398 polyPtr->coordPtr[objc] = polyPtr->coordPtr[0];
399 polyPtr->coordPtr[objc+1] = polyPtr->coordPtr[1];
400 }
401
402 ComputePolygonBbox(canvas, polyPtr);
409403 return TCL_OK;
410404 }
411405
470464 itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT;
471465 }
472466
473 if(state == TK_STATE_NULL) {
467 if (state == TK_STATE_NULL) {
474468 state = Canvas(canvas)->canvas_state;
475469 }
476 if (state==TK_STATE_HIDDEN) {
470 if (state == TK_STATE_HIDDEN) {
477471 ComputePolygonBbox(canvas, polyPtr);
478472 return TCL_OK;
479473 }
480474
481 mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(polyPtr->outline));
475 mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &polyPtr->outline);
482476 if (mask) {
483477 gcValues.cap_style = CapRound;
484478 gcValues.join_style = polyPtr->joinStyle;
495489 color = polyPtr->fillColor;
496490 stipple = polyPtr->fillStipple;
497491 if (Canvas(canvas)->currentItemPtr == itemPtr) {
498 if (polyPtr->activeFillColor!=NULL) {
492 if (polyPtr->activeFillColor != NULL) {
499493 color = polyPtr->activeFillColor;
500494 }
501 if (polyPtr->activeFillStipple!=None) {
495 if (polyPtr->activeFillStipple != None) {
502496 stipple = polyPtr->activeFillStipple;
503497 }
504 } else if (state==TK_STATE_DISABLED) {
505 if (polyPtr->disabledFillColor!=NULL) {
498 } else if (state == TK_STATE_DISABLED) {
499 if (polyPtr->disabledFillColor != NULL) {
506500 color = polyPtr->disabledFillColor;
507501 }
508 if (polyPtr->disabledFillStipple!=None) {
502 if (polyPtr->disabledFillStipple != None) {
509503 stipple = polyPtr->disabledFillStipple;
510504 }
511505 }
525519 * Mac OS X CG drawing needs access to the outline linewidth
526520 * even for fills (as linewidth controls antialiasing).
527521 */
528 gcValues.line_width = polyPtr->outline.gc != None ?
522 gcValues.line_width = polyPtr->outline.gc != None ?
529523 polyPtr->outline.gc->line_width : 0;
530524 mask |= GCLineWidth;
531525 #endif
575569 {
576570 PolygonItem *polyPtr = (PolygonItem *) itemPtr;
577571
578 Tk_DeleteOutline(display,&(polyPtr->outline));
572 Tk_DeleteOutline(display, &polyPtr->outline);
579573 if (polyPtr->coordPtr != NULL) {
580574 ckfree((char *) polyPtr->coordPtr);
581575 }
630624 Tk_State state = polyPtr->header.state;
631625 Tk_TSOffset *tsoffset;
632626
633 if(state == TK_STATE_NULL) {
627 if (state == TK_STATE_NULL) {
634628 state = Canvas(canvas)->canvas_state;
635629 }
636630 width = polyPtr->outline.width;
637 if (polyPtr->coordPtr == NULL || (polyPtr->numPoints < 1) || (state==TK_STATE_HIDDEN)) {
631 if (polyPtr->coordPtr == NULL || (polyPtr->numPoints < 1)
632 || (state == TK_STATE_HIDDEN)) {
638633 polyPtr->header.x1 = polyPtr->header.x2 =
639 polyPtr->header.y1 = polyPtr->header.y2 = -1;
634 polyPtr->header.y1 = polyPtr->header.y2 = -1;
640635 return;
641636 }
642 if (Canvas(canvas)->currentItemPtr == (Tk_Item *)polyPtr) {
643 if (polyPtr->outline.activeWidth>width) {
637 if (Canvas(canvas)->currentItemPtr == (Tk_Item *) polyPtr) {
638 if (polyPtr->outline.activeWidth > width) {
644639 width = polyPtr->outline.activeWidth;
645640 }
646 } else if (state==TK_STATE_DISABLED) {
647 if (polyPtr->outline.disabledWidth>0.0) {
641 } else if (state == TK_STATE_DISABLED) {
642 if (polyPtr->outline.disabledWidth > 0.0) {
648643 width = polyPtr->outline.disabledWidth;
649644 }
650645 }
670665 tsoffset = &polyPtr->tsoffset;
671666 if (tsoffset->flags & TK_OFFSET_INDEX) {
672667 int index = tsoffset->flags & ~TK_OFFSET_INDEX;
668
673669 if (tsoffset->flags == INT_MAX) {
674670 index = (polyPtr->numPoints - polyPtr->autoClosed) * 2;
675671 if (index < 0) {
677673 }
678674 }
679675 index %= (polyPtr->numPoints - polyPtr->autoClosed) * 2;
680 if (index <0) {
676 if (index < 0) {
681677 index += (polyPtr->numPoints - polyPtr->autoClosed) * 2;
682678 }
683679 tsoffset->xoffset = (int) (polyPtr->coordPtr[index] + 0.5);
709705 index = (polyPtr->numPoints - 1) * 2;
710706 }
711707 index %= (polyPtr->numPoints - 1) * 2;
712 if (index <0) {
708 if (index < 0) {
713709 index += (polyPtr->numPoints - 1) * 2;
714710 }
715711 tsoffset->xoffset = (int) (polyPtr->coordPtr[index] + 0.5);
718714 if (tsoffset->flags & TK_OFFSET_LEFT) {
719715 tsoffset->xoffset = polyPtr->header.x1;
720716 } else if (tsoffset->flags & TK_OFFSET_CENTER) {
721 tsoffset->xoffset = (polyPtr->header.x1 + polyPtr->header.x2)/2;
717 tsoffset->xoffset =
718 (polyPtr->header.x1 + polyPtr->header.x2) / 2;
722719 } else if (tsoffset->flags & TK_OFFSET_RIGHT) {
723720 tsoffset->xoffset = polyPtr->header.x2;
724721 }
725722 if (tsoffset->flags & TK_OFFSET_TOP) {
726723 tsoffset->yoffset = polyPtr->header.y1;
727724 } else if (tsoffset->flags & TK_OFFSET_MIDDLE) {
728 tsoffset->yoffset = (polyPtr->header.y1 + polyPtr->header.y2)/2;
725 tsoffset->yoffset =
726 (polyPtr->header.y1 + polyPtr->header.y2) / 2;
729727 } else if (tsoffset->flags & TK_OFFSET_BOTTOM) {
730728 tsoffset->yoffset = polyPtr->header.y2;
731729 }
732730 }
733731 }
734732
735 i = (int) ((width+1.5)/2.0);
733 i = (int) ((width+1.5) / 2.0);
736734 polyPtr->header.x1 -= i;
737735 polyPtr->header.x2 += i;
738736 polyPtr->header.y1 -= i;
749747 int j;
750748
751749 coordPtr = polyPtr->coordPtr;
752 if (polyPtr->numPoints>3) {
750 if (polyPtr->numPoints > 3) {
753751 if (TkGetMiterPoints(coordPtr+2*(polyPtr->numPoints-2),
754 coordPtr, coordPtr+2, width,
755 miter, miter+2)) {
752 coordPtr, coordPtr+2, width, miter, miter+2)) {
756753 for (j = 0; j < 4; j += 2) {
757754 TkIncludePoint((Tk_Item *) polyPtr, miter+j);
758755 }
759756 }
760 }
757 }
761758 for (i = polyPtr->numPoints ; i >= 3; i--, coordPtr += 2) {
762
763 if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4,
764 width, miter, miter+2)) {
759 if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4, width,
760 miter, miter+2)) {
765761 for (j = 0; j < 4; j += 2) {
766762 TkIncludePoint((Tk_Item *) polyPtr, miter+j);
767763 }
828824 if (numPoints <= MAX_STATIC_POINTS) {
829825 pointPtr = staticPoints;
830826 } else {
831 pointPtr = (XPoint *) ckalloc((unsigned) (numPoints * sizeof(XPoint)));
827 pointPtr = (XPoint *) ckalloc((unsigned) numPoints * sizeof(XPoint));
832828 }
833829
834830 for (i=0, pPtr=pointPtr ; i<numPoints; i+=1, coordPtr+=2, pPtr++) {
841837 * allocated.
842838 */
843839
844 if (gc != None && numPoints>3) {
840 if (gc != None && numPoints > 3) {
845841 XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex,
846842 CoordModeOrigin);
847843 }
848844 if (outlineGC != None) {
849 XDrawLines(display, drawable, outlineGC, pointPtr,
850 numPoints, CoordModeOrigin);
845 XDrawLines(display, drawable, outlineGC, pointPtr, numPoints,
846 CoordModeOrigin);
851847 }
852848 if (pointPtr != staticPoints) {
853849 ckfree((char *) pointPtr);
896892 state = Canvas(canvas)->canvas_state;
897893 }
898894 if (Canvas(canvas)->currentItemPtr == itemPtr) {
899 if (polyPtr->outline.activeWidth>linewidth) {
895 if (polyPtr->outline.activeWidth > linewidth) {
900896 linewidth = polyPtr->outline.activeWidth;
901897 }
902898 if (polyPtr->activeFillStipple != None) {
903899 stipple = polyPtr->activeFillStipple;
904900 }
905 } else if (state==TK_STATE_DISABLED) {
906 if (polyPtr->outline.disabledWidth>0.0) {
901 } else if (state == TK_STATE_DISABLED) {
902 if (polyPtr->outline.disabledWidth > 0.0) {
907903 linewidth = polyPtr->outline.disabledWidth;
908904 }
909905 if (polyPtr->disabledFillStipple != None) {
918914
919915 if ((stipple != None) && (polyPtr->fillGC != None)) {
920916 Tk_TSOffset *tsoffset = &polyPtr->tsoffset;
921 int w=0; int h=0;
917 int w = 0, h = 0;
922918 int flags = tsoffset->flags;
923919
924 if (!(flags & TK_OFFSET_INDEX) && (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) {
920 if (!(flags & TK_OFFSET_INDEX)
921 && (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) {
925922 Tk_SizeOfBitmap(display, stipple, &w, &h);
926923 if (flags & TK_OFFSET_CENTER) {
927924 w /= 2;
940937 tsoffset->xoffset += w;
941938 tsoffset->yoffset += h;
942939 }
943 Tk_ChangeOutlineGC(canvas, itemPtr, &(polyPtr->outline));
944
945 if(polyPtr->numPoints < 3) {
946 short x,y;
940 Tk_ChangeOutlineGC(canvas, itemPtr, &polyPtr->outline);
941
942 if (polyPtr->numPoints < 3) {
943 short x, y;
947944 int intLineWidth = (int) (linewidth + 0.5);
948945
949946 if (intLineWidth < 1) {
950947 intLineWidth = 1;
951948 }
952949 Tk_CanvasDrawableCoords(canvas, polyPtr->coordPtr[0],
953 polyPtr->coordPtr[1], &x,&y);
950 polyPtr->coordPtr[1], &x, &y);
954951 XFillArc(display, drawable, polyPtr->outline.gc,
955952 x - intLineWidth/2, y - intLineWidth/2,
956 (unsigned int)intLineWidth+1, (unsigned int)intLineWidth+1,
953 (unsigned) intLineWidth+1, (unsigned) intLineWidth+1,
957954 0, 64*360);
958955 } else if (!polyPtr->smooth || polyPtr->numPoints < 4) {
959956 TkFillPolygon(canvas, polyPtr->coordPtr, polyPtr->numPoints,
973970 if (numPoints <= MAX_STATIC_POINTS) {
974971 pointPtr = staticPoints;
975972 } else {
976 pointPtr = (XPoint *) ckalloc((unsigned)
977 (numPoints * sizeof(XPoint)));
973 pointPtr = (XPoint *)
974 ckalloc((unsigned) numPoints * sizeof(XPoint));
978975 }
979976 numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
980977 polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL);
990987 ckfree((char *) pointPtr);
991988 }
992989 }
993 Tk_ResetOutlineGC(canvas, itemPtr, &(polyPtr->outline));
990 Tk_ResetOutlineGC(canvas, itemPtr, &polyPtr->outline);
994991 if ((stipple != None) && (polyPtr->fillGC != None)) {
995992 XSetTSOrigin(display, polyPtr->fillGC, 0, 0);
996993 }
10351032 return;
10361033 }
10371034 length = 2*(polyPtr->numPoints - polyPtr->autoClosed);
1038 while (beforeThis>length) {
1035 while (beforeThis > length) {
10391036 beforeThis -= length;
10401037 }
1041 while (beforeThis<0) {
1038 while (beforeThis < 0) {
10421039 beforeThis += length;
10431040 }
10441041 newCoordPtr = (double *)
10851082
10861083 newCoordPtr[length] = newCoordPtr[0];
10871084 newCoordPtr[length+1] = newCoordPtr[1];
1088 if (((length-objc)>3) && (state != TK_STATE_HIDDEN)) {
1085 if ((length-objc > 3) && (state != TK_STATE_HIDDEN)) {
10891086 /*
10901087 * This is some optimizing code that will result that only the part of
10911088 * the polygon that changed (and the objects that are overlapping with
10971094
10981095 double width;
10991096 int j;
1097
11001098 itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
11011099
11021100 /*
11081106
11091107 itemPtr->x1 = itemPtr->x2 = (int) polyPtr->coordPtr[beforeThis];
11101108 itemPtr->y1 = itemPtr->y2 = (int) polyPtr->coordPtr[beforeThis+1];
1111 beforeThis-=2; objc+=4;
1109 beforeThis -= 2;
1110 objc += 4;
11121111 if (polyPtr->smooth) {
1113 beforeThis-=2;
1114 objc+=4;
1112 beforeThis -= 2;
1113 objc += 4;
11151114 }
11161115
11171116 /*
11201119
11211120 for (i=beforeThis; i<beforeThis+objc; i+=2) {
11221121 j = i;
1123 if (j<0) {
1122 if (j < 0) {
11241123 j += length;
1125 } else if (j>=length) {
1124 } else if (j >= length) {
11261125 j -= length;
11271126 }
11281127 TkIncludePoint(itemPtr, polyPtr->coordPtr+j);
11321131 if (polyPtr->outline.activeWidth > width) {
11331132 width = polyPtr->outline.activeWidth;
11341133 }
1135 } else if (state==TK_STATE_DISABLED) {
1134 } else if (state == TK_STATE_DISABLED) {
11361135 if (polyPtr->outline.disabledWidth > 0.0) {
11371136 width = polyPtr->outline.disabledWidth;
11381137 }
11391138 }
1140 itemPtr->x1 -= (int) width; itemPtr->y1 -= (int) width;
1141 itemPtr->x2 += (int) width; itemPtr->y2 += (int) width;
1139 itemPtr->x1 -= (int) width;
1140 itemPtr->y1 -= (int) width;
1141 itemPtr->x2 += (int) width;
1142 itemPtr->y2 += (int) width;
11421143 Tk_CanvasEventuallyRedraw(canvas,
11431144 itemPtr->x1, itemPtr->y1, itemPtr->x2, itemPtr->y2);
11441145 }
11741175 int count, i;
11751176 int length = 2*(polyPtr->numPoints - polyPtr->autoClosed);
11761177
1177 while (first>=length) {
1178 while (first >= length) {
11781179 first -= length;
11791180 }
1180 while (first<0) {
1181 while (first < 0) {
11811182 first += length;
11821183 }
1183 while (last>=length) {
1184 while (last >= length) {
11841185 last -= length;
11851186 }
1186 while (last<0) {
1187 while (last < 0) {
11871188 last += length;
11881189 }
11891190
11911192 last &= -2;
11921193
11931194 count = last + 2 - first;
1194 if (count<=0) {
1195 if (count <= 0) {
11951196 count += length;
11961197 }
11971198
12041205 return;
12051206 }
12061207
1207 if (last>=first) {
1208 for(i=last+2; i<length; i++) {
1208 if (last >= first) {
1209 for (i=last+2; i<length; i++) {
12091210 polyPtr->coordPtr[i-count] = polyPtr->coordPtr[i];
12101211 }
12111212 } else {
1212 for(i=last; i<=first; i++) {
1213 for (i=last; i<=first; i++) {
12131214 polyPtr->coordPtr[i-last] = polyPtr->coordPtr[i];
12141215 }
12151216 }
12661267 }
12671268 width = polyPtr->outline.width;
12681269 if (Canvas(canvas)->currentItemPtr == itemPtr) {
1269 if (polyPtr->outline.activeWidth>width) {
1270 if (polyPtr->outline.activeWidth > width) {
12701271 width = polyPtr->outline.activeWidth;
12711272 }
1272 } else if (state==TK_STATE_DISABLED) {
1273 if (polyPtr->outline.disabledWidth>0.0) {
1273 } else if (state == TK_STATE_DISABLED) {
1274 if (polyPtr->outline.disabledWidth > 0.0) {
12741275 width = polyPtr->outline.disabledWidth;
12751276 }
12761277 }
12811282 * against which to do the check.
12821283 */
12831284
1284 if ((polyPtr->smooth) && (polyPtr->numPoints>2)) {
1285 if ((polyPtr->smooth) && (polyPtr->numPoints > 2)) {
12851286 numPoints = polyPtr->smooth->coordProc(canvas, NULL,
1286 polyPtr->numPoints, polyPtr->splineSteps, NULL,
1287 NULL);
1287 polyPtr->numPoints, polyPtr->splineSteps, NULL, NULL);
12881288 if (numPoints <= MAX_STATIC_POINTS) {
12891289 polyPoints = staticSpace;
12901290 } else {
1291 polyPoints = (double *) ckalloc((unsigned)
1292 (2*numPoints*sizeof(double)));
1291 polyPoints = (double *)
1292 ckalloc((unsigned) 2*numPoints*sizeof(double));
12931293 }
12941294 numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
1295 polyPtr->numPoints, polyPtr->splineSteps, NULL,
1296 polyPoints);
1295 polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
12971296 } else {
12981297 numPoints = polyPtr->numPoints;
12991298 polyPoints = polyPtr->coordPtr;
13001299 }
13011300
13021301 bestDist = TkPolygonToPoint(polyPoints, numPoints, pointPtr);
1303 if (bestDist<=0.0) {
1302 if (bestDist <= 0.0) {
13041303 goto donepoint;
13051304 }
13061305 if ((polyPtr->outline.gc != None) && (polyPtr->joinStyle == JoinRound)) {
13501349 */
13511350
13521351 if (count == numPoints) {
1353 TkGetButtPoints(coordPtr+2, coordPtr, (double) width,
1354 0, poly, poly+2);
1352 TkGetButtPoints(coordPtr+2, coordPtr, (double) width, 0, poly,
1353 poly+2);
13551354 } else if ((polyPtr->joinStyle == JoinMiter) && !changedMiterToBevel) {
13561355 poly[0] = poly[6];
13571356 poly[1] = poly[7];
13581357 poly[2] = poly[4];
13591358 poly[3] = poly[5];
13601359 } else {
1361 TkGetButtPoints(coordPtr+2, coordPtr, (double) width, 0,
1362 poly, poly+2);
1360 TkGetButtPoints(coordPtr+2, coordPtr, (double) width, 0, poly,
1361 poly+2);
13631362
13641363 /*
13651364 * If this line uses beveled joints, then check the distance to a
13821381 }
13831382 }
13841383 if (count == 2) {
1385 TkGetButtPoints(coordPtr, coordPtr+2, (double) width,
1386 0, poly+4, poly+6);
1384 TkGetButtPoints(coordPtr, coordPtr+2, (double) width, 0, poly+4,
1385 poly+6);
13871386 } else if (polyPtr->joinStyle == JoinMiter) {
13881387 if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4,
13891388 (double) width, poly+4, poly+6) == 0) {
13921391 poly+4, poly+6);
13931392 }
13941393 } else {
1395 TkGetButtPoints(coordPtr, coordPtr+2, (double) width, 0,
1396 poly+4, poly+6);
1394 TkGetButtPoints(coordPtr, coordPtr+2, (double) width, 0, poly+4,
1395 poly+6);
13971396 }
13981397 poly[8] = poly[0];
13991398 poly[9] = poly[1];
14071406 }
14081407
14091408 donepoint:
1410 if ((polyPoints != staticSpace) && polyPoints != polyPtr->coordPtr) {
1409 if (polyPoints != staticSpace && polyPoints != polyPtr->coordPtr) {
14111410 ckfree((char *) polyPoints);
14121411 }
14131412 return bestDist;
14641463
14651464 width = polyPtr->outline.width;
14661465 if (Canvas(canvas)->currentItemPtr == itemPtr) {
1467 if (polyPtr->outline.activeWidth>width) {
1466 if (polyPtr->outline.activeWidth > width) {
14681467 width = polyPtr->outline.activeWidth;
14691468 }
1470 } else if (state==TK_STATE_DISABLED) {
1471 if (polyPtr->outline.disabledWidth>0.0) {
1469 } else if (state == TK_STATE_DISABLED) {
1470 if (polyPtr->outline.disabledWidth > 0.0) {
14721471 width = polyPtr->outline.disabledWidth;
14731472 }
14741473 }
14761475 radius = width/2.0;
14771476 inside = -1;
14781477
1479 if ((state==TK_STATE_HIDDEN) || polyPtr->numPoints<2) {
1478 if ((state == TK_STATE_HIDDEN) || polyPtr->numPoints < 2) {
14801479 return -1;
1481 } else if (polyPtr->numPoints <3) {
1480 } else if (polyPtr->numPoints < 3) {
14821481 double oval[4];
14831482
14841483 oval[0] = polyPtr->coordPtr[0]-radius;
15001499 polyPoints = staticSpace;
15011500 } else {
15021501 polyPoints = (double *)
1503 ckalloc((unsigned) (2*numPoints*sizeof(double)));
1502 ckalloc((unsigned) 2*numPoints*sizeof(double));
15041503 }
15051504 numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
15061505 polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
15161515 */
15171516
15181517 inside = TkPolygonToArea(polyPoints, numPoints, rectPtr);
1519 if (inside==0) {
1518 if (inside == 0) {
15201519 goto donearea;
15211520 }
15221521
15851584 if (count == 2) {
15861585 TkGetButtPoints(coordPtr, coordPtr+2, width, 0, poly+4, poly+6);
15871586 } else if (polyPtr->joinStyle == JoinMiter) {
1588 if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4,
1589 width, poly+4, poly+6) == 0) {
1587 if (TkGetMiterPoints(coordPtr, coordPtr+2, coordPtr+4, width,
1588 poly+4, poly+6) == 0) {
15901589 changedMiterToBevel = 1;
15911590 TkGetButtPoints(coordPtr, coordPtr+2, width,0, poly+4, poly+6);
15921591 }
16821681 char *string = Tcl_GetStringFromObj(obj, &length);
16831682
16841683 if (string[0] == 'e') {
1685 if (strncmp(string, "end", (unsigned)length) == 0) {
1686 *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed);
1687 } else {
1688 /*
1689 * Some of the paths here leave messages in interp->result, so we
1690 * have to clear it out before storing our own message.
1691 */
1692
1693 badIndex:
1694 Tcl_SetResult(interp, NULL, TCL_STATIC);
1695 Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL);
1696 return TCL_ERROR;
1697 }
1684 if (strncmp(string, "end", (unsigned)length) != 0) {
1685 goto badIndex;
1686 }
1687 *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed);
16981688 } else if (string[0] == '@') {
16991689 int i;
1700 double x ,y, bestDist, dist, *coordPtr;
1690 double x, y, bestDist, dist, *coordPtr;
17011691 char *end, *p;
17021692
17031693 p = string+1;
17131703 bestDist = 1.0e36;
17141704 coordPtr = polyPtr->coordPtr;
17151705 *indexPtr = 0;
1716 for(i=0; i<(polyPtr->numPoints-1); i++) {
1706 for (i=0; i<polyPtr->numPoints-1; i++) {
17171707 dist = hypot(coordPtr[0] - x, coordPtr[1] - y);
1718 if (dist<bestDist) {
1708 if (dist < bestDist) {
17191709 bestDist = dist;
17201710 *indexPtr = 2*i;
17211711 }
17281718 goto badIndex;
17291719 }
17301720 *indexPtr &= -2; /* if odd, make it even */
1731 if (count) {
1732 if (*indexPtr > 0) {
1733 *indexPtr = ((*indexPtr - 2) % count) + 2;
1734 } else {
1735 *indexPtr = -((-(*indexPtr)) % count);
1736 }
1721 if (!count) {
1722 *indexPtr = 0;
1723 } else if (*indexPtr > 0) {
1724 *indexPtr = ((*indexPtr - 2) % count) + 2;
17371725 } else {
1738 *indexPtr = 0;
1726 *indexPtr = -((-(*indexPtr)) % count);
17391727 }
17401728 }
17411729 return TCL_OK;
1730
1731 /*
1732 * Some of the paths here leave messages in interp->result, so we have to
1733 * clear it out before storing our own message.
1734 */
1735
1736 badIndex:
1737 Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string));
1738 return TCL_ERROR;
17421739 }
17431740
17441741 /*
18061803 * being created. */
18071804 {
18081805 PolygonItem *polyPtr = (PolygonItem *) itemPtr;
1809 char *style;
1806 const char *style;
18101807 XColor *color;
18111808 XColor *fillColor;
18121809 Pixmap stipple;
18141811 Tk_State state = itemPtr->state;
18151812 double width;
18161813
1817 if (polyPtr->numPoints<2 || polyPtr->coordPtr==NULL) {
1814 if (polyPtr->numPoints < 2 || polyPtr->coordPtr == NULL) {
18181815 return TCL_OK;
18191816 }
18201817
1821 if(state == TK_STATE_NULL) {
1818 if (state == TK_STATE_NULL) {
18221819 state = Canvas(canvas)->canvas_state;
18231820 }
18241821 width = polyPtr->outline.width;
18271824 fillColor = polyPtr->fillColor;
18281825 fillStipple = polyPtr->fillStipple;
18291826 if (Canvas(canvas)->currentItemPtr == itemPtr) {
1830 if (polyPtr->outline.activeWidth>width) {
1827 if (polyPtr->outline.activeWidth > width) {
18311828 width = polyPtr->outline.activeWidth;
18321829 }
1833 if (polyPtr->outline.activeColor!=NULL) {
1830 if (polyPtr->outline.activeColor != NULL) {
18341831 color = polyPtr->outline.activeColor;
18351832 }
1836 if (polyPtr->outline.activeStipple!=None) {
1833 if (polyPtr->outline.activeStipple != None) {
18371834 stipple = polyPtr->outline.activeStipple;
18381835 }
1839 if (polyPtr->activeFillColor!=NULL) {
1836 if (polyPtr->activeFillColor != NULL) {
18401837 fillColor = polyPtr->activeFillColor;
18411838 }
1842 if (polyPtr->activeFillStipple!=None) {
1839 if (polyPtr->activeFillStipple != None) {
18431840 fillStipple = polyPtr->activeFillStipple;
18441841 }
1845 } else if (state==TK_STATE_DISABLED) {
1846 if (polyPtr->outline.disabledWidth>0.0) {
1842 } else if (state == TK_STATE_DISABLED) {
1843 if (polyPtr->outline.disabledWidth > 0.0) {
18471844 width = polyPtr->outline.disabledWidth;
18481845 }
1849 if (polyPtr->outline.disabledColor!=NULL) {
1846 if (polyPtr->outline.disabledColor != NULL) {
18501847 color = polyPtr->outline.disabledColor;
18511848 }
1852 if (polyPtr->outline.disabledStipple!=None) {
1849 if (polyPtr->outline.disabledStipple != None) {
18531850 stipple = polyPtr->outline.disabledStipple;
18541851 }
1855 if (polyPtr->disabledFillColor!=NULL) {
1852 if (polyPtr->disabledFillColor != NULL) {
18561853 fillColor = polyPtr->disabledFillColor;
18571854 }
1858 if (polyPtr->disabledFillStipple!=None) {
1855 if (polyPtr->disabledFillStipple != None) {
18591856 fillStipple = polyPtr->disabledFillStipple;
18601857 }
18611858 }
1862 if (polyPtr->numPoints==2) {
1863 char string[128];
1859 if (polyPtr->numPoints == 2) {
18641860 if (color == NULL) {
18651861 return TCL_OK;
18661862 }
18671863
1868 sprintf(string, "%.15g %.15g translate %.15g %.15g",
1869 polyPtr->coordPtr[0], Tk_CanvasPsY(canvas, polyPtr->coordPtr[1]),
1870 width/2.0, width/2.0);
1871 Tcl_AppendResult(interp, "matrix currentmatrix\n",string,
1872 " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", NULL);
1864 /*
1865 * Create a point by using a small circle. (Printer pixels are too
1866 * tiny to be used directly...)
1867 */
1868
1869 Tcl_SetObjResult(interp, Tcl_ObjPrintf(
1870 "matrix currentmatrix\n" /* save state */
1871 "%.15g %.15g translate " /* go to drawing location */
1872 "%.15g %.15g scale " /* scale the drawing */
1873 "1 0 moveto " /* correct for origin */
1874 "0 0 1 0 360 arc\n" /* make the circle */
1875 "setmatrix\n", /* restore state */
1876 polyPtr->coordPtr[0],
1877 Tk_CanvasPsY(canvas, polyPtr->coordPtr[1]),
1878 width/2.0, width/2.0));
1879
1880 /*
1881 * Color it in.
1882 */
1883
18731884 if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
18741885 return TCL_ERROR;
18751886 }
18881899 * Fill the area of the polygon.
18891900 */
18901901
1891 if (fillColor != NULL && polyPtr->numPoints>3) {
1902 if (fillColor != NULL && polyPtr->numPoints > 3) {
18921903 if (!polyPtr->smooth || !polyPtr->smooth->postscriptProc) {
18931904 Tk_CanvasPsPath(interp, canvas, polyPtr->coordPtr,
18941905 polyPtr->numPoints);
19321943 } else {
19331944 style = "0";
19341945 }
1935 Tcl_AppendResult(interp, style," setlinejoin 1 setlinecap\n", NULL);
1936 if (Tk_CanvasPsOutline(canvas, itemPtr,
1937 &(polyPtr->outline)) != TCL_OK) {
1946 Tcl_AppendResult(interp, style, " setlinejoin 1 setlinecap\n", NULL);
1947 if (Tk_CanvasPsOutline(canvas, itemPtr, &polyPtr->outline) != TCL_OK){
19381948 return TCL_ERROR;
19391949 }
19401950 }
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkCanvPs.c,v 1.20 2008/04/27 22:38:55 dkf Exp $
13 * RCS: @(#) $Id: tkCanvPs.c,v 1.25 2008/12/07 16:34:12 das Exp $
1414 */
1515
1616 #include "tkInt.h"
1717 #include "tkCanvas.h"
18 #include "tkFont.h"
1819
1920 /*
2021 * See tkCanvas.h for key data structures used to implement canvases.
8081 * pre-pass that collects font information, so
8182 * the Postscript generated isn't relevant. */
8283 int prolog; /* Non-zero means output should contain the
83 * file prolog.ps in the header. */
84 * standard prolog in the header. Generated in
85 * library/mkpsenc.tcl, stored in the variable
86 * ::tk::ps_preamable [sic]. */
87 Tk_Window tkwin; /* Window to get font pixel/point transform
88 * from. */
8489 } TkPostscriptInfo;
8590
8691 /*
172177 Tcl_HashSearch search;
173178 Tcl_HashEntry *hPtr;
174179 Tcl_DString buffer;
175 char psenccmd[] = "::tk::ensure_psenc_is_loaded";
180 static const char *psenccmd = "::tk::ensure_psenc_is_loaded";
176181 int deltaX = 0, deltaY = 0; /* Offset of lower-left corner of area to be
177182 * marked up, measured in canvas units from
178183 * the positioning point on the page (reflects
184189 * process all the arguments to fill the data structure in.
185190 */
186191
187 result = Tcl_EvalEx(interp,psenccmd,-1,TCL_EVAL_GLOBAL);
192 result = Tcl_EvalEx(interp, psenccmd, -1, TCL_EVAL_GLOBAL);
188193 if (result != TCL_OK) {
189194 return result;
190195 }
212217 psInfo.chan = NULL;
213218 psInfo.prepass = 0;
214219 psInfo.prolog = 1;
220 psInfo.tkwin = tkwin;
215221 Tcl_InitHashTable(&psInfo.fontTable, TCL_STRING_KEYS);
216222 result = Tk_ConfigureWidget(interp, tkwin, configSpecs, argc-2, argv+2,
217223 (char *) &psInfo, TK_CONFIG_ARGV_ONLY);
382388 if (itemPtr->typePtr->postscriptProc == NULL) {
383389 continue;
384390 }
385 result = (*itemPtr->typePtr->postscriptProc)(interp,
391 result = itemPtr->typePtr->postscriptProc(interp,
386392 (Tk_Canvas) canvasPtr, itemPtr, 1);
387393 Tcl_ResetResult(interp);
388394 if (result != TCL_OK) {
392398 * can happen later that don't happen now, so we still have to
393399 * check for errors later anyway).
394400 */
401
395402 break;
396403 }
397404 }
452459 * Insert the prolog
453460 */
454461
455 Tcl_AppendResult(interp, Tcl_GetVar(interp,"::tk::ps_preamable",
462 Tcl_AppendResult(interp, Tcl_GetVar(interp, "::tk::ps_preamable",
456463 TCL_GLOBAL_ONLY), NULL);
457464
458465 if (psInfo.chan != NULL) {
526533 continue;
527534 }
528535 Tcl_AppendResult(interp, "gsave\n", NULL);
529 result = (*itemPtr->typePtr->postscriptProc)(interp,
536 result = itemPtr->typePtr->postscriptProc(interp,
530537 (Tk_Canvas) canvasPtr, itemPtr, 0);
531538 if (result != TCL_OK) {
532539 char msg[64 + TCL_INTEGER_SPACE];
725732
726733 if (Tcl_ListObjGetElements(interp, list, &objc, &objv) != TCL_OK
727734 || objc != 2
728 || Tcl_GetString(objv[0])[0]=='\0'
735 || Tcl_GetString(objv[0])[0] == '\0'
729736 || Tcl_GetDoubleFromObj(interp, objv[1], &size) != TCL_OK
730737 || size <= 0) {
731738 Tcl_ResetResult(interp);
735742 }
736743
737744 fontname = Tcl_GetString(objv[0]);
738 sprintf(pointString, "%d", (int)size);
745 sprintf(pointString, "%d", (int) size);
739746
740747 Tcl_AppendResult(interp, "/", fontname, " findfont ",
741748 pointString, " scalefont ", NULL);
754761
755762 Tcl_DStringInit(&ds);
756763 points = Tk_PostscriptFontName(tkfont, &ds);
757 sprintf(pointString, "%d", points);
764 sprintf(pointString, "%d", TkFontGetPoints(psInfoPtr->tkwin, points));
758765 Tcl_AppendResult(interp, "/", Tcl_DStringValue(&ds), " findfont ",
759766 pointString, " scalefont ", NULL);
760767 if (strncasecmp(Tcl_DStringValue(&ds), "Symbol", 7) != 0) {
12471254 * monochrome screen, use gray or monochrome mode instead.
12481255 */
12491256
1250 if (!cdata.color && level == 2) {
1257 if (!cdata.color && level >= 2) {
12511258 level = 1;
12521259 }
12531260
12641271 switch (level) {
12651272 case 0: bytesPerLine = (width + 7) / 8; maxWidth = 240000; break;
12661273 case 1: bytesPerLine = width; maxWidth = 60000; break;
1267 case 2: bytesPerLine = 3 * width; maxWidth = 20000; break;
1274 default: bytesPerLine = 3 * width; maxWidth = 20000; break;
12681275 }
12691276
12701277 if (bytesPerLine > 60000) {
12921299 sprintf(buffer, "%d %d 8 matrix {\n<", width, rows);
12931300 Tcl_AppendResult(interp, buffer, NULL);
12941301 break;
1295 case 2:
1302 default:
12961303 sprintf(buffer, "%d %d 8 matrix {\n<", width, rows);
12971304 Tcl_AppendResult(interp, buffer, NULL);
12981305 break;
13541361 }
13551362 }
13561363 break;
1357 case 2:
1364 default:
13581365 /*
13591366 * Finally, color mode. Here, just output the red, green, and
13601367 * blue values directly.
13801387 switch (level) {
13811388 case 0: case 1:
13821389 sprintf(buffer, ">\n} image\n"); break;
1383 case 2:
1390 default:
13841391 sprintf(buffer, ">\n} false 3 colorimage\n"); break;
13851392 }
13861393 Tcl_AppendResult(interp, buffer, NULL);
15791586 switch (colorLevel) {
15801587 case 0: bytesPerLine = (width + 7) / 8; maxWidth = 240000; break;
15811588 case 1: bytesPerLine = width; maxWidth = 60000; break;
1582 case 2: bytesPerLine = 3 * width; maxWidth = 20000; break;
1589 default: bytesPerLine = 3 * width; maxWidth = 20000; break;
15831590 }
15841591 if (bytesPerLine > 60000) {
15851592 Tcl_ResetResult(interp);
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkCanvText.c,v 1.29 2008/10/03 15:37:13 dkf Exp $
11 * RCS: @(#) $Id: tkCanvText.c,v 1.35 2008/11/23 15:08:58 dkf Exp $
1212 */
1313
1414 #include <stdio.h>
5656 * means no word-wrap. */
5757 int underline; /* Index of character to put underline beneath
5858 * or -1 for no underlining. */
59 double angle; /* What angle, in degrees, to draw the text
60 * at. */
5961
6062 /*
6163 * Fields whose values are derived from the current values of the
6567 int numChars; /* Length of text in characters. */
6668 int numBytes; /* Length of text in bytes. */
6769 Tk_TextLayout textLayout; /* Cached text layout information. */
68 int leftEdge; /* Pixel location of the left edge of the text
69 * item; where the left border of the text
70 * layout is drawn. */
71 int rightEdge; /* Pixel just to right of right edge of area
72 * of text item. Used for selecting up to end
73 * of line. */
70 int actualWidth; /* Width of text as computed. Used to make
71 * selections of wrapped text display
72 * right. */
73 double drawOrigin[2]; /* Where we start drawing from. */
7474 GC gc; /* Graphics context for drawing text. */
7575 GC selTextGC; /* Graphics context for selected text. */
7676 GC cursorOffGC; /* If not None, this gives a graphics context
7777 * to use to draw the insertion cursor when
7878 * it's off. Used if the selection and
7979 * insertion cursor colors are the same. */
80 double sine; /* Sine of angle field. */
81 double cosine; /* Cosine of angle field. */
8082 } TextItem;
8183
8284 /*
8385 * Information used for parsing configuration specs:
8486 */
8587
86 static Tk_CustomOption stateOption = {
87 (Tk_OptionParseProc *) TkStateParseProc,
88 TkStatePrintProc, (ClientData) 2
88 static const Tk_CustomOption stateOption = {
89 TkStateParseProc, TkStatePrintProc, (ClientData) 2
8990 };
90 static Tk_CustomOption tagsOption = {
91 (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
92 Tk_CanvasTagsPrintProc, (ClientData) NULL
91 static const Tk_CustomOption tagsOption = {
92 Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
9393 };
94 static Tk_CustomOption offsetOption = {
95 (Tk_OptionParseProc *) TkOffsetParseProc,
96 TkOffsetPrintProc, (ClientData) (TK_OFFSET_RELATIVE)
94 static const Tk_CustomOption offsetOption = {
95 TkOffsetParseProc, TkOffsetPrintProc, (ClientData) (TK_OFFSET_RELATIVE)
9796 };
9897
9998 static Tk_ConfigSpec configSpecs[] = {
103102 NULL, Tk_Offset(TextItem, activeStipple), TK_CONFIG_NULL_OK},
104103 {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL,
105104 "center", Tk_Offset(TextItem, anchor), TK_CONFIG_DONT_SET_DEFAULT},
105 {TK_CONFIG_DOUBLE, "-angle", NULL, NULL,
106 "0.0", Tk_Offset(TextItem, angle), TK_CONFIG_DONT_SET_DEFAULT},
106107 {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
107108 NULL, Tk_Offset(TextItem, disabledColor), TK_CONFIG_NULL_OK},
108109 {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
201202 TextDeleteChars, /* dTextProc */
202203 NULL, /* nextPtr */
203204 };
205
206 #define ROUND(d) ((int) floor((d) + 0.5))
204207
205208 /*
206209 *--------------------------------------------------------------
260263 textPtr->text = NULL;
261264 textPtr->width = 0;
262265 textPtr->underline = -1;
266 textPtr->angle = 0.0;
263267
264268 textPtr->numChars = 0;
265269 textPtr->numBytes = 0;
266270 textPtr->textLayout = NULL;
267 textPtr->leftEdge = 0;
268 textPtr->rightEdge = 0;
271 textPtr->actualWidth = 0;
272 textPtr->drawOrigin[0] = textPtr->drawOrigin[1] = 0.0;
269273 textPtr->gc = None;
270274 textPtr->selTextGC = None;
271275 textPtr->cursorOffGC = None;
276 textPtr->sine = 0.0;
277 textPtr->cosine = 1.0;
272278
273279 /*
274280 * Process the arguments to fill in the item record. Only 1 (list) or 2 (x
327333
328334 if (objc == 0) {
329335 Tcl_Obj *obj = Tcl_NewObj();
330
331336 Tcl_Obj *subobj = Tcl_NewDoubleObj(textPtr->x);
337
332338 Tcl_ListObjAppendElement(interp, obj, subobj);
333339 subobj = Tcl_NewDoubleObj(textPtr->y);
334340 Tcl_ListObjAppendElement(interp, obj, subobj);
335341 Tcl_SetObjResult(interp, obj);
336342 } else if (objc < 3) {
337 if (objc==1) {
343 if (objc == 1) {
338344 if (Tcl_ListObjGetElements(interp, objv[0], &objc,
339345 (Tcl_Obj ***) &objv) != TCL_OK) {
340346 return TCL_ERROR;
341347 } else if (objc != 2) {
342 char buf[64 + TCL_INTEGER_SPACE];
343
344 sprintf(buf, "wrong # coordinates: expected 2, got %d", objc);
345 Tcl_SetResult(interp, buf, TCL_VOLATILE);
348 Tcl_SetObjResult(interp, Tcl_ObjPrintf(
349 "wrong # coordinates: expected 2, got %d", objc));
346350 return TCL_ERROR;
347351 }
348352 }
354358 }
355359 ComputeTextBbox(canvas, textPtr);
356360 } else {
357 char buf[64 + TCL_INTEGER_SPACE];
358
359 sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc);
360 Tcl_SetResult(interp, buf, TCL_VOLATILE);
361 Tcl_SetObjResult(interp, Tcl_ObjPrintf(
362 "wrong # coordinates: expected 0 or 2, got %d", objc));
361363 return TCL_ERROR;
362364 }
363365 return TCL_OK;
421423 itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT;
422424 }
423425
424 if(state == TK_STATE_NULL) {
426 if (state == TK_STATE_NULL) {
425427 state = Canvas(canvas)->canvas_state;
426428 }
427429
428430 color = textPtr->color;
429431 stipple = textPtr->stipple;
430432 if (Canvas(canvas)->currentItemPtr == itemPtr) {
431 if (textPtr->activeColor!=NULL) {
433 if (textPtr->activeColor != NULL) {
432434 color = textPtr->activeColor;
433435 }
434 if (textPtr->activeStipple!=None) {
436 if (textPtr->activeStipple != None) {
435437 stipple = textPtr->activeStipple;
436438 }
437 } else if (state==TK_STATE_DISABLED) {
438 if (textPtr->disabledColor!=NULL) {
439 } else if (state == TK_STATE_DISABLED) {
440 if (textPtr->disabledColor != NULL) {
439441 color = textPtr->disabledColor;
440442 }
441 if (textPtr->disabledStipple!=None) {
443 if (textPtr->disabledStipple != None) {
442444 stipple = textPtr->disabledStipple;
443445 }
444446 }
494496 }
495497 textPtr->cursorOffGC = newGC;
496498
497
498499 /*
499500 * If the text was changed, move the selection and insertion indices to
500501 * keep them inside the item.
520521 textPtr->insertPos = textPtr->numChars;
521522 }
522523
524 /*
525 * Restrict so that 0.0 <= angle < 360.0, and then recompute the cached
526 * sine and cosine of the angle. Note that fmod() can produce negative
527 * results, and we try to avoid negative zero as well.
528 */
529
530 textPtr->angle = fmod(textPtr->angle, 360.0);
531 if (textPtr->angle < 0.0) {
532 textPtr->angle += 360.0;
533 }
534 if (textPtr->angle == 0.0) {
535 textPtr->angle = 0.0;
536 }
537 textPtr->sine = sin(textPtr->angle * PI/180.0);
538 textPtr->cosine = cos(textPtr->angle * PI/180.0);
539
523540 ComputeTextBbox(canvas, textPtr);
524541 return TCL_OK;
525542 }
610627 TextItem *textPtr) /* Item whose bbox is to be recomputed. */
611628 {
612629 Tk_CanvasTextInfo *textInfoPtr;
613 int leftX, topY, width, height, fudge;
630 int leftX, topY, width, height, fudge, i;
614631 Tk_State state = textPtr->header.state;
615
616 if(state == TK_STATE_NULL) {
632 double x[4], y[4], dx[4], dy[4], sinA, cosA, tmp;
633
634 if (state == TK_STATE_NULL) {
617635 state = Canvas(canvas)->canvas_state;
618636 }
619637
631649 * bounding box for the text item.
632650 */
633651
634 leftX = (int) floor(textPtr->x + 0.5);
635 topY = (int) floor(textPtr->y + 0.5);
652 leftX = ROUND(textPtr->x);
653 topY = ROUND(textPtr->y);
654 for (i=0 ; i<4 ; i++) {
655 dx[i] = dy[i] = 0.0;
656 }
636657 switch (textPtr->anchor) {
637658 case TK_ANCHOR_NW:
638659 case TK_ANCHOR_N:
643664 case TK_ANCHOR_CENTER:
644665 case TK_ANCHOR_E:
645666 topY -= height / 2;
667 for (i=0 ; i<4 ; i++) {
668 dy[i] = -height / 2;
669 }
646670 break;
647671
648672 case TK_ANCHOR_SW:
649673 case TK_ANCHOR_S:
650674 case TK_ANCHOR_SE:
651675 topY -= height;
676 for (i=0 ; i<4 ; i++) {
677 dy[i] = -height;
678 }
652679 break;
653680 }
654681 switch (textPtr->anchor) {
661688 case TK_ANCHOR_CENTER:
662689 case TK_ANCHOR_S:
663690 leftX -= width / 2;
691 for (i=0 ; i<4 ; i++) {
692 dx[i] = -width / 2;
693 }
664694 break;
665695
666696 case TK_ANCHOR_NE:
667697 case TK_ANCHOR_E:
668698 case TK_ANCHOR_SE:
669699 leftX -= width;
700 for (i=0 ; i<4 ; i++) {
701 dx[i] = -width;
702 }
670703 break;
671704 }
672705
673 textPtr->leftEdge = leftX;
674 textPtr->rightEdge = leftX + width;
706 textPtr->actualWidth = width;
707
708 sinA = textPtr->sine;
709 cosA = textPtr->cosine;
710 textPtr->drawOrigin[0] = textPtr->x + dx[0]*cosA + dy[0]*sinA;
711 textPtr->drawOrigin[1] = textPtr->y + dy[0]*cosA - dx[0]*sinA;
675712
676713 /*
677714 * Last of all, update the bounding box for the item. The item's bounding
684721 if (textInfoPtr->selBorderWidth > fudge) {
685722 fudge = textInfoPtr->selBorderWidth;
686723 }
687 textPtr->header.x1 = leftX - fudge;
688 textPtr->header.y1 = topY;
689 textPtr->header.x2 = leftX + width + fudge;
690 textPtr->header.y2 = topY + height;
724
725 /*
726 * Apply the rotation before computing the bounding box.
727 */
728
729 dx[0] -= fudge;
730 dx[1] += width + fudge;
731 dx[2] += width + fudge;
732 dy[2] += height;
733 dx[3] -= fudge;
734 dy[3] += height;
735 for (i=0 ; i<4 ; i++) {
736 x[i] = textPtr->x + dx[i] * cosA + dy[i] * sinA;
737 y[i] = textPtr->y + dy[i] * cosA - dx[i] * sinA;
738 }
739
740 /*
741 * Convert to a rectilinear bounding box.
742 */
743
744 for (i=1,tmp=x[0] ; i<4 ; i++) {
745 if (x[i] < tmp) {
746 tmp = x[i];
747 }
748 }
749 textPtr->header.x1 = ROUND(tmp);
750 for (i=1,tmp=y[0] ; i<4 ; i++) {
751 if (y[i] < tmp) {
752 tmp = y[i];
753 }
754 }
755 textPtr->header.y1 = ROUND(tmp);
756 for (i=1,tmp=x[0] ; i<4 ; i++) {
757 if (x[i] > tmp) {
758 tmp = x[i];
759 }
760 }
761 textPtr->header.x2 = ROUND(tmp);
762 for (i=1,tmp=y[0] ; i<4 ; i++) {
763 if (y[i] > tmp) {
764 tmp = y[i];
765 }
766 }
767 textPtr->header.y2 = ROUND(tmp);
691768 }
692769
693770 /*
727804 textPtr = (TextItem *) itemPtr;
728805 textInfoPtr = textPtr->textInfoPtr;
729806
730 if(state == TK_STATE_NULL) {
807 if (state == TK_STATE_NULL) {
731808 state = Canvas(canvas)->canvas_state;
732809 }
733810 stipple = textPtr->stipple;
734811 if (Canvas(canvas)->currentItemPtr == itemPtr) {
735 if (textPtr->activeStipple!=None) {
812 if (textPtr->activeStipple != None) {
736813 stipple = textPtr->activeStipple;
737814 }
738 } else if (state==TK_STATE_DISABLED) {
739 if (textPtr->disabledStipple!=None) {
815 } else if (state == TK_STATE_DISABLED) {
816 if (textPtr->disabledStipple != None) {
740817 stipple = textPtr->disabledStipple;
741818 }
742819 }
757834
758835 selFirstChar = -1;
759836 selLastChar = 0; /* lint. */
837 Tk_CanvasDrawableCoords(canvas, textPtr->drawOrigin[0],
838 textPtr->drawOrigin[1], &drawableX, &drawableY);
760839
761840 if (textInfoPtr->selItemPtr == itemPtr) {
762841 selFirstChar = textInfoPtr->selectFirst;
787866 x = xFirst;
788867 height = hFirst;
789868 for (y = yFirst ; y <= yLast; y += height) {
869 int dx1, dy1, dx2, dy2;
870 double s = textPtr->sine, c = textPtr->cosine;
871 XPoint points[4];
872
790873 if (y == yLast) {
791874 width = xLast + wLast - x;
792875 } else {
793 width = textPtr->rightEdge - textPtr->leftEdge - x;
876 width = textPtr->actualWidth - x;
794877 }
795 Tk_CanvasDrawableCoords(canvas,
796 (double) (textPtr->leftEdge + x
797 - textInfoPtr->selBorderWidth),
798 (double) (textPtr->header.y1 + y),
799 &drawableX, &drawableY);
800 Tk_Fill3DRectangle(Tk_CanvasTkwin(canvas), drawable,
801 textInfoPtr->selBorder, drawableX, drawableY,
802 width + 2 * textInfoPtr->selBorderWidth,
803 height, textInfoPtr->selBorderWidth, TK_RELIEF_RAISED);
878 dx1 = x - textInfoPtr->selBorderWidth;
879 dy1 = y;
880 dx2 = width + 2 * textInfoPtr->selBorderWidth;
881 dy2 = height;
882 points[0].x = (short)(drawableX + dx1*c + dy1*s);
883 points[0].y = (short)(drawableY + dy1*c - dx1*s);
884 points[1].x = (short)(drawableX + (dx1+dx2)*c + dy1*s);
885 points[1].y = (short)(drawableY + dy1*c - (dx1+dx2)*s);
886 points[2].x = (short)(drawableX + (dx1+dx2)*c + (dy1+dy2)*s);
887 points[2].y = (short)(drawableY + (dy1+dy2)*c - (dx1+dx2)*s);
888 points[3].x = (short)(drawableX + dx1*c + (dy1+dy2)*s);
889 points[3].y = (short)(drawableY + (dy1+dy2)*c - dx1*s);
890 Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable,
891 textInfoPtr->selBorder, points, 4,
892 textInfoPtr->selBorderWidth, TK_RELIEF_RAISED);
804893 x = 0;
805894 }
806895 }
818907 if ((textInfoPtr->focusItemPtr == itemPtr) && (textInfoPtr->gotFocus)) {
819908 if (Tk_CharBbox(textPtr->textLayout, textPtr->insertPos,
820909 &x, &y, NULL, &height)) {
821 Tk_CanvasDrawableCoords(canvas,
822 (double) (textPtr->leftEdge + x
823 - (textInfoPtr->insertWidth / 2)),
824 (double) (textPtr->header.y1 + y),
825 &drawableX, &drawableY);
826 Tk_SetCaretPos(Tk_CanvasTkwin(canvas), drawableX, drawableY,
910 int dx1, dy1, dx2, dy2;
911 double s = textPtr->sine, c = textPtr->cosine;
912 XPoint points[4];
913
914 dx1 = x - (textInfoPtr->insertWidth / 2);
915 dy1 = y;
916 dx2 = textInfoPtr->insertWidth;
917 dy2 = height;
918 points[0].x = (short)(drawableX + dx1*c + dy1*s);
919 points[0].y = (short)(drawableY + dy1*c - dx1*s);
920 points[1].x = (short)(drawableX + (dx1+dx2)*c + dy1*s);
921 points[1].y = (short)(drawableY + dy1*c - (dx1+dx2)*s);
922 points[2].x = (short)(drawableX + (dx1+dx2)*c + (dy1+dy2)*s);
923 points[2].y = (short)(drawableY + (dy1+dy2)*c - (dx1+dx2)*s);
924 points[3].x = (short)(drawableX + dx1*c + (dy1+dy2)*s);
925 points[3].y = (short)(drawableY + (dy1+dy2)*c - dx1*s);
926
927 Tk_SetCaretPos(Tk_CanvasTkwin(canvas), points[0].x, points[0].y,
827928 height);
828929 if (textInfoPtr->cursorOn) {
829 Tk_Fill3DRectangle(Tk_CanvasTkwin(canvas), drawable,
830 textInfoPtr->insertBorder,
831 drawableX, drawableY,
832 textInfoPtr->insertWidth, height,
930 Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable,
931 textInfoPtr->insertBorder, points, 4,
833932 textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED);
834933 } else if (textPtr->cursorOffGC != None) {
835934 /*
839938 * where both may be drawn in the same color.
840939 */
841940
842 XFillRectangle(display, drawable, textPtr->cursorOffGC,
843 drawableX, drawableY,
844 (unsigned) textInfoPtr->insertWidth,
845 (unsigned) height);
941 XFillPolygon(display, drawable, textPtr->cursorOffGC,
942 points, 4, Convex, CoordModeOrigin);
846943 }
847944 }
848945 }
857954 * anti-aliasing colors would blend together.
858955 */
859956
860 Tk_CanvasDrawableCoords(canvas, (double) textPtr->leftEdge,
861 (double) textPtr->header.y1, &drawableX, &drawableY);
862
863957 if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) {
864 Tk_DrawTextLayout(display, drawable, textPtr->gc, textPtr->textLayout,
865 drawableX, drawableY, 0, selFirstChar);
866 Tk_DrawTextLayout(display, drawable, textPtr->selTextGC,
867 textPtr->textLayout, drawableX, drawableY, selFirstChar,
868 selLastChar + 1);
869 Tk_DrawTextLayout(display, drawable, textPtr->gc, textPtr->textLayout,
870 drawableX, drawableY, selLastChar + 1, -1);
958 TkDrawAngledTextLayout(display, drawable, textPtr->gc,
959 textPtr->textLayout, drawableX, drawableY, textPtr->angle,
960 0, selFirstChar);
961 TkDrawAngledTextLayout(display, drawable, textPtr->selTextGC,
962 textPtr->textLayout, drawableX, drawableY, textPtr->angle,
963 selFirstChar, selLastChar + 1);
964 TkDrawAngledTextLayout(display, drawable, textPtr->gc,
965 textPtr->textLayout, drawableX, drawableY, textPtr->angle,
966 selLastChar + 1, -1);
871967 } else {
872 Tk_DrawTextLayout(display, drawable, textPtr->gc, textPtr->textLayout,
873 drawableX, drawableY, 0, -1);
874 }
875 Tk_UnderlineTextLayout(display, drawable, textPtr->gc, textPtr->textLayout,
876 drawableX, drawableY, textPtr->underline);
968 TkDrawAngledTextLayout(display, drawable, textPtr->gc,
969 textPtr->textLayout, drawableX, drawableY, textPtr->angle,
970 0, -1);
971 }
972 TkUnderlineAngledTextLayout(display, drawable, textPtr->gc,
973 textPtr->textLayout, drawableX, drawableY, textPtr->angle,
974 textPtr->underline);
877975
878976 if (stipple != None) {
879977 XSetTSOrigin(display, textPtr->gc, 0, 0);
881979 }
882980
883981 /*
884 *--------------------------------------------------------------
982 *----------------------------------------------------------------------
885983 *
886984 * TextInsert --
887985 *
894992 * The text in the given item is modified. The cursor and selection
895993 * positions are also modified to reflect the insertion.
896994 *
897 *--------------------------------------------------------------
995 *----------------------------------------------------------------------
898996 */
899997
900998 static void
9261024 return;
9271025 }
9281026
929 newStr = (char *) ckalloc((unsigned) textPtr->numBytes + byteCount + 1);
1027 newStr = ckalloc((unsigned) textPtr->numBytes + byteCount + 1);
9301028 memcpy(newStr, text, (size_t) byteIndex);
9311029 strcpy(newStr + byteIndex, string);
9321030 strcpy(newStr + byteIndex + byteCount, text + byteIndex);
10071105 byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved)
10081106 - (text + byteIndex);
10091107
1010 newStr = (char *) ckalloc((unsigned) (textPtr->numBytes + 1 - byteCount));
1108 newStr = ckalloc((unsigned) (textPtr->numBytes + 1 - byteCount));
10111109 memcpy(newStr, text, (size_t) byteIndex);
10121110 strcpy(newStr + byteIndex, text + byteIndex + byteCount);
10131111
10831181 {
10841182 TextItem *textPtr;
10851183 Tk_State state = itemPtr->state;
1086 double value;
1184 double value, px, py;
10871185
10881186 if (state == TK_STATE_NULL) {
10891187 state = Canvas(canvas)->canvas_state;
10901188 }
10911189 textPtr = (TextItem *) itemPtr;
1190 px = pointPtr[0] - textPtr->drawOrigin[0];
1191 py = pointPtr[1] - textPtr->drawOrigin[1];
10921192 value = (double) Tk_DistanceToTextLayout(textPtr->textLayout,
1093 (int) pointPtr[0] - textPtr->leftEdge,
1094 (int) pointPtr[1] - textPtr->header.y1);
1193 (int) (px*textPtr->cosine - py*textPtr->sine),
1194 (int) (py*textPtr->cosine + px*textPtr->sine));
10951195
10961196 if ((state == TK_STATE_HIDDEN) || (textPtr->color == NULL) ||
10971197 (textPtr->text == NULL) || (*textPtr->text == 0)) {
11351235 }
11361236
11371237 textPtr = (TextItem *) itemPtr;
1138 return Tk_IntersectTextLayout(textPtr->textLayout,
1139 (int) (rectPtr[0] + 0.5) - textPtr->leftEdge,
1140 (int) (rectPtr[1] + 0.5) - textPtr->header.y1,
1238 return TkIntersectAngledTextLayout(textPtr->textLayout,
1239 (int) ((rectPtr[0] + 0.5) - textPtr->drawOrigin[0]),
1240 (int) ((rectPtr[1] + 0.5) - textPtr->drawOrigin[1]),
11411241 (int) (rectPtr[2] - rectPtr[0] + 0.5),
1142 (int) (rectPtr[3] - rectPtr[1] + 0.5));
1242 (int) (rectPtr[3] - rectPtr[1] + 0.5),
1243 textPtr->angle);
11431244 }
11441245
11451246 /*
12681369 *indexPtr = textInfoPtr->selectLast;
12691370 } else if (c == '@') {
12701371 int x, y;
1271 double tmp;
1372 double tmp, c = textPtr->cosine, s = textPtr->sine;
12721373 char *end, *p;
12731374
12741375 p = string+1;
12831384 goto badIndex;
12841385 }
12851386 y = (int) ((tmp < 0) ? tmp - 0.5 : tmp + 0.5);
1286 *indexPtr = Tk_PointToChar(textPtr->textLayout,
1287 x + canvasPtr->scrollX1 - textPtr->leftEdge,
1288 y + canvasPtr->scrollY1 - textPtr->header.y1);
1387 x += canvasPtr->scrollX1 - (int) textPtr->drawOrigin[0];
1388 y += canvasPtr->scrollY1 - (int) textPtr->drawOrigin[1];
1389 *indexPtr = Tk_PointToChar(textPtr->textLayout,
1390 (int) (x*c - y*s), (int) (y*c + x*s));
12891391 } else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) {
1290 if (*indexPtr < 0){
1392 if (*indexPtr < 0) {
12911393 *indexPtr = 0;
12921394 } else if (*indexPtr > textPtr->numChars) {
12931395 *indexPtr = textPtr->numChars;
12991401 */
13001402
13011403 badIndex:
1302 Tcl_SetResult(interp, NULL, TCL_STATIC);
1303 Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL);
1404 Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string));
13041405 return TCL_ERROR;
13051406 }
13061407 return TCL_OK;
14281529 * being created. */
14291530 {
14301531 TextItem *textPtr = (TextItem *) itemPtr;
1431 int x, y;
1532 double x, y;
14321533 Tk_FontMetrics fm;
1433 char *justify;
1434 char buffer[500];
1534 const char *justify;
14351535 XColor *color;
14361536 Pixmap stipple;
14371537 Tk_State state = itemPtr->state;
14451545 textPtr->text == NULL || *textPtr->text == 0) {
14461546 return TCL_OK;
14471547 } else if (Canvas(canvas)->currentItemPtr == itemPtr) {
1448 if (textPtr->activeColor!=NULL) {
1548 if (textPtr->activeColor != NULL) {
14491549 color = textPtr->activeColor;
14501550 }
1451 if (textPtr->activeStipple!=None) {
1551 if (textPtr->activeStipple != None) {
14521552 stipple = textPtr->activeStipple;
14531553 }
1454 } else if (state==TK_STATE_DISABLED) {
1455 if (textPtr->disabledColor!=NULL) {
1554 } else if (state == TK_STATE_DISABLED) {
1555 if (textPtr->disabledColor != NULL) {
14561556 color = textPtr->disabledColor;
14571557 }
1458 if (textPtr->disabledStipple!=None) {
1558 if (textPtr->disabledStipple != None) {
14591559 stipple = textPtr->disabledStipple;
14601560 }
14611561 }
14751575 Tcl_AppendResult(interp, "} bind def\n", NULL);
14761576 }
14771577
1478 sprintf(buffer, "%.15g %.15g [\n", textPtr->x,
1479 Tk_CanvasPsY(canvas, textPtr->y));
1480 Tcl_AppendResult(interp, buffer, NULL);
1578 Tcl_AppendPrintfToObj(Tcl_GetObjResult(interp), "%.15g %.15g %.15g [\n",
1579 textPtr->angle, textPtr->x, Tk_CanvasPsY(canvas, textPtr->y));
14811580
14821581 Tk_TextLayoutToPostscript(interp, textPtr->textLayout);
14831582
15001599 }
15011600
15021601 Tk_GetFontMetrics(textPtr->tkfont, &fm);
1503 sprintf(buffer, "] %d ", fm.linespace);
1504 Tcl_AppendResult(interp, buffer, NULL);
1505 Tcl_PrintDouble(NULL, x / -2.0, buffer);
1506 Tcl_AppendResult(interp, buffer, " ", NULL);
1507 Tcl_PrintDouble(NULL, y / 2.0, buffer);
1508 Tcl_AppendResult(interp, buffer, NULL);
1509 sprintf(buffer, " %s %s DrawText\n", justify,
1602 Tcl_AppendPrintfToObj(Tcl_GetObjResult(interp),
1603 "] %d %g %g %s %s DrawText\n",
1604 fm.linespace, x / -2.0, y / 2.0, justify,
15101605 ((stipple == None) ? "false" : "true"));
1511 Tcl_AppendResult(interp, buffer, NULL);
15121606
15131607 return TCL_OK;
15141608 }
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkCanvUtil.c,v 1.20 2008/04/27 22:38:55 dkf Exp $
11 * RCS: @(#) $Id: tkCanvUtil.c,v 1.24 2008/11/27 23:47:09 ferrieux Exp $
1212 */
1313
1414 #include "tkInt.h"
2626 * option. */
2727 } SmoothAssocData;
2828
29 Tk_SmoothMethod tkBezierSmoothMethod = {
29 const Tk_SmoothMethod tkBezierSmoothMethod = {
3030 "true",
3131 TkMakeBezierCurve,
3232 (void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr,
3333 int numPoints, int numSteps)) TkMakeBezierPostscript,
3434 };
35 static Tk_SmoothMethod tkRawSmoothMethod = {
35 static const Tk_SmoothMethod tkRawSmoothMethod = {
3636 "raw",
3737 TkMakeRawCurve,
3838 (void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr,
260260 * form may be used here). */
261261 double *doublePtr) /* Place to store converted coordinate. */
262262 {
263 if (Tk_GetMMFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj,
264 doublePtr) != TCL_OK) {
265 return TCL_ERROR;
266 }
267 *doublePtr *= Canvas(canvas)->pixelsPerMM;
268 return TCL_OK;
263 return Tk_GetDoublePixelsFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj, doublePtr);
269264 }
270265
271266 /*
456451 *--------------------------------------------------------------
457452 */
458453
459 char *
454 const char *
460455 Tk_CanvasTagsPrintProc(
461456 ClientData clientData, /* Ignored. */
462457 Tk_Window tkwin, /* Window containing canvas widget. */
474469 }
475470 if (itemPtr->numTags == 1) {
476471 *freeProcPtr = NULL;
477 return (char *) itemPtr->tagPtr[0];
472 return (const char *) itemPtr->tagPtr[0];
478473 }
479474 *freeProcPtr = TCL_DYNAMIC;
480475 return Tcl_Merge(itemPtr->numTags, (const char **) itemPtr->tagPtr);
532527 *--------------------------------------------------------------
533528 */
534529
535 char *
530 const char *
536531 TkCanvasDashPrintProc(
537532 ClientData clientData, /* Ignored. */
538533 Tk_Window tkwin, /* Window containing canvas widget. */
632627 void
633628 Tk_CreateSmoothMethod(
634629 Tcl_Interp *interp,
635 Tk_SmoothMethod *smooth)
630 const Tk_SmoothMethod *smooth)
636631 {
637632 SmoothAssocData *methods, *typePtr2, *prevPtr, *ptr;
638633 methods = Tcl_GetAssocData(interp, "smoothMethod", NULL);
727722 char *widgRec, /* Pointer to record for item. */
728723 int offset) /* Offset into item. */
729724 {
730 register Tk_SmoothMethod **smoothPtr =
731 (Tk_SmoothMethod **) (widgRec + offset);
732 Tk_SmoothMethod *smooth = NULL;
725 register const Tk_SmoothMethod **smoothPtr =
726 (const Tk_SmoothMethod **) (widgRec + offset);
727 const Tk_SmoothMethod *smooth = NULL;
733728 int b;
734729 size_t length;
735730 SmoothAssocData *methods;
808803 *--------------------------------------------------------------
809804 */
810805
811 char *
806 const char *
812807 TkSmoothPrintProc(
813808 ClientData clientData, /* Ignored. */
814809 Tk_Window tkwin, /* Window containing canvas widget. */
818813 * information about how to reclaim storage
819814 * for return string. */
820815 {
821 register Tk_SmoothMethod **smoothPtr =
822 (Tk_SmoothMethod **) (widgRec + offset);
823
824 return (*smoothPtr) ? (*smoothPtr)->name : "0";
816 register const Tk_SmoothMethod *smoothPtr =
817 * (Tk_SmoothMethod **) (widgRec + offset);
818
819 return smoothPtr ? smoothPtr->name : "0";
825820 }
826821 /*
827822 *--------------------------------------------------------------
18021797 /*
18031798 * The current vertex is to the left of xClip
18041799 */
1800
18051801 if (!inside) {
18061802 /*
18071803 * If the current vertex is on the left of xClip and one
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkCanvWind.c,v 1.17 2008/04/27 22:38:55 dkf Exp $
11 * RCS: @(#) $Id: tkCanvWind.c,v 1.18 2008/11/09 20:51:28 nijtmans Exp $
1212 */
1313
1414 #include <stdio.h>
3939 * Information used for parsing configuration specs:
4040 */
4141
42 static Tk_CustomOption stateOption = {
43 (Tk_OptionParseProc *) TkStateParseProc,
44 TkStatePrintProc, (ClientData) 2
42 static const Tk_CustomOption stateOption = {
43 TkStateParseProc, TkStatePrintProc, (ClientData) 2
4544 };
46 static Tk_CustomOption tagsOption = {
47 (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
48 Tk_CanvasTagsPrintProc, (ClientData) NULL
45 static const Tk_CustomOption tagsOption = {
46 Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
4947 };
5048
5149 static Tk_ConfigSpec configSpecs[] = {
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkCanvas.c,v 1.51 2008/09/30 23:54:46 dkf Exp $
14 * RCS: @(#) $Id: tkCanvas.c,v 1.58 2008/12/09 21:22:56 dgp Exp $
1515 */
1616
1717 /* #define USE_OLD_TAG_SEARCH 1 */
101101 * Custom option for handling "-state" and "-offset"
102102 */
103103
104 static Tk_CustomOption stateOption = {
105 (Tk_OptionParseProc *) TkStateParseProc,
106 TkStatePrintProc,
104 static const Tk_CustomOption stateOption = {
105 TkStateParseProc, TkStatePrintProc,
107106 (ClientData) NULL /* Only "normal" and "disabled". */
108107 };
109108
110 static Tk_CustomOption offsetOption = {
111 (Tk_OptionParseProc *) TkOffsetParseProc,
112 TkOffsetPrintProc,
109 static const Tk_CustomOption offsetOption = {
110 TkOffsetParseProc, TkOffsetPrintProc,
113111 (ClientData) TK_OFFSET_RELATIVE
114112 };
115113
267265 static int CanvasWidgetCmd(ClientData clientData,
268266 Tcl_Interp *interp, int argc,
269267 Tcl_Obj *const *argv);
270 static void CanvasWorldChanged(
271 ClientData instanceData);
268 static void CanvasWorldChanged(ClientData instanceData);
272269 static int ConfigureCanvas(Tcl_Interp *interp,
273270 TkCanvas *canvasPtr, int argc,
274271 Tcl_Obj *const *argv, int flags);
276273 static void DisplayCanvas(ClientData clientData);
277274 static void DoItem(Tcl_Interp *interp,
278275 Tk_Item *itemPtr, Tk_Uid tag);
279 static void EventuallyRedrawItem(Tk_Canvas canvas,
276 static void EventuallyRedrawItem(TkCanvas *canvasPtr,
280277 Tk_Item *itemPtr);
281278 #ifdef USE_OLD_TAG_SEARCH
282279 static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr,
340337 #define FOR_EVERY_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
341338 for ((itemPtr) = StartTagSearch(canvasPtr, (objPtr), &search); \
342339 (itemPtr) != NULL; (itemPtr) = NextItem(&search))
340 #define FIND_ITEMS(objPtr, n) \
341 FindItems(interp, canvasPtr, objc, objv, (objPtr), (n))
342 #define RELINK_ITEMS(objPtr, itemPtr) \
343 RelinkItems(canvasPtr, (objPtr), (itemPtr))
343344 #else /* USE_OLD_TAG_SEARCH */
344345 #define FIRST_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \
345346 if ((result=TagSearchScan(canvasPtr,(objPtr),(searchPtrPtr))) != TCL_OK){ \
352353 } \
353354 for (itemPtr = TagSearchFirst(*(searchPtrPtr)); \
354355 itemPtr != NULL; itemPtr = TagSearchNext(*(searchPtrPtr)))
356 #define FIND_ITEMS(objPtr, n) \
357 FindItems(interp, canvasPtr, objc, objv, (objPtr), (n), &searchPtr)
358 #define RELINK_ITEMS(objPtr, itemPtr) \
359 result = RelinkItems(canvasPtr, (objPtr), (itemPtr), &searchPtr)
355360 #endif /* USE_OLD_TAG_SEARCH */
356
361
362 /*
363 * ----------------------------------------------------------------------
364 *
365 * AlwaysRedraw, ItemConfigure, ItemCoords, etc. --
366 *
367 * Helper functions that make access to canvas item functions simpler.
368 * Note that these are all inline functions.
369 *
370 * ----------------------------------------------------------------------
371 */
372
373 static inline int
374 AlwaysRedraw(
375 Tk_Item *itemPtr)
376 {
377 return itemPtr->typePtr->alwaysRedraw & 1;
378 }
379
380 static inline int
381 ItemConfigure(
382 TkCanvas *canvasPtr,
383 Tk_Item *itemPtr,
384 int objc,
385 Tcl_Obj *const objv[])
386 {
387 Tcl_Interp *interp = canvasPtr->interp;
388 int result;
389
390 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
391 result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr,
392 itemPtr, objc, objv, TK_CONFIG_ARGV_ONLY);
393 } else {
394 const char **args = TkGetStringsFromObjs(objc, objv);
395
396 result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr,
397 itemPtr, objc, (Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY);
398 if (args != NULL) {
399 ckfree((char *) args);
400 }
401 }
402 return result;
403 }
404
405 static inline int
406 ItemConfigInfo(
407 TkCanvas *canvasPtr,
408 Tk_Item *itemPtr,
409 Tcl_Obj *fieldName)
410 {
411 return Tk_ConfigureInfo(canvasPtr->interp, canvasPtr->tkwin,
412 itemPtr->typePtr->configSpecs, (char *) itemPtr,
413 (fieldName ? Tcl_GetString(fieldName) : NULL), 0);
414 }
415
416 static inline int
417 ItemConfigValue(
418 TkCanvas *canvasPtr,
419 Tk_Item *itemPtr,
420 Tcl_Obj *fieldName)
421 {
422 return Tk_ConfigureValue(canvasPtr->interp, canvasPtr->tkwin,
423 itemPtr->typePtr->configSpecs, (char *) itemPtr,
424 Tcl_GetString(fieldName), 0);
425 }
426
427 static inline int
428 ItemCoords(
429 TkCanvas *canvasPtr,
430 Tk_Item *itemPtr,
431 int objc,
432 Tcl_Obj *const objv[])
433 {
434 Tcl_Interp *interp = canvasPtr->interp;
435 int result;
436
437 if (itemPtr->typePtr->coordProc == NULL) {
438 result = TCL_OK;
439 } else if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
440 result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr,
441 itemPtr, objc, objv);
442 } else {
443 const char **args = TkGetStringsFromObjs(objc, objv);
444
445 result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr,
446 itemPtr, objc, (Tcl_Obj **) args);
447 if (args != NULL) {
448 ckfree((char *) args);
449 }
450 }
451 return result;
452 }
453
454 static inline int
455 ItemCreate(
456 TkCanvas *canvasPtr,
457 Tk_Item *itemPtr, /* Warning: incomplete! typePtr field must be
458 * set by this point. */
459 int objc,
460 Tcl_Obj *const objv[])
461 {
462 Tcl_Interp *interp = canvasPtr->interp;
463 int result;
464
465 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
466 result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr,
467 itemPtr, objc-3, objv+3);
468 } else {
469 const char **args = TkGetStringsFromObjs(objc-3, objv+3);
470
471 result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr,
472 itemPtr, objc-3, (Tcl_Obj **) args);
473 if (args != NULL) {
474 ckfree((char *) args);
475 }
476 }
477 return result;
478 }
479
480 static inline void
481 ItemCursor(
482 TkCanvas *canvasPtr,
483 Tk_Item *itemPtr,
484 int index)
485 {
486 itemPtr->typePtr->icursorProc((Tk_Canvas) canvasPtr, itemPtr, index);
487 }
488
489 static inline void
490 ItemDelChars(
491 TkCanvas *canvasPtr,
492 Tk_Item *itemPtr,
493 int first,
494 int last)
495 {
496 itemPtr->typePtr->dCharsProc((Tk_Canvas) canvasPtr, itemPtr, first, last);
497 }
498
499 static inline void
500 ItemDelete(
501 TkCanvas *canvasPtr,
502 Tk_Item *itemPtr)
503 {
504 itemPtr->typePtr->deleteProc((Tk_Canvas) canvasPtr, itemPtr,
505 canvasPtr->display);
506 }
507
508 static inline void
509 ItemDisplay(
510 TkCanvas *canvasPtr,
511 Tk_Item *itemPtr,
512 Pixmap pixmap,
513 int screenX1, int screenY1,
514 int width, int height)
515 {
516 itemPtr->typePtr->displayProc((Tk_Canvas) canvasPtr, itemPtr,
517 canvasPtr->display, pixmap, screenX1, screenY1, width, height);
518 }
519
520 static inline int
521 ItemIndex(
522 TkCanvas *canvasPtr,
523 Tk_Item *itemPtr,
524 Tcl_Obj *objPtr,
525 int *indexPtr)
526 {
527 Tcl_Interp *interp = canvasPtr->interp;
528
529 if (itemPtr->typePtr->indexProc == NULL) {
530 return TCL_OK;
531 } else if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
532 return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
533 itemPtr, (char *) objPtr, indexPtr);
534 } else {
535 return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
536 itemPtr, Tcl_GetString(objPtr), indexPtr);
537 }
538 }
539
540 static inline void
541 ItemInsert(
542 TkCanvas *canvasPtr,
543 Tk_Item *itemPtr,
544 int beforeThis,
545 Tcl_Obj *toInsert)
546 {
547 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
548 itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr,
549 beforeThis, (char *) toInsert);
550 } else {
551 itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr,
552 beforeThis, Tcl_GetString(toInsert));
553 }
554 }
555
556 static inline int
557 ItemOverlap(
558 TkCanvas *canvasPtr,
559 Tk_Item *itemPtr,
560 double rect[])
561 {
562 return itemPtr->typePtr->areaProc((Tk_Canvas) canvasPtr, itemPtr, rect);
563 }
564
565 static inline double
566 ItemPoint(
567 TkCanvas *canvasPtr,
568 Tk_Item *itemPtr,
569 double coords[],
570 double halo)
571 {
572 double dist;
573
574 dist = itemPtr->typePtr->pointProc((Tk_Canvas) canvasPtr, itemPtr,
575 coords) - halo;
576 return (dist < 0.0) ? 0.0 : dist;
577 }
578
579 static inline void
580 ItemScale(
581 TkCanvas *canvasPtr,
582 Tk_Item *itemPtr,
583 double xOrigin, double yOrigin,
584 double xScale, double yScale)
585 {
586 itemPtr->typePtr->scaleProc((Tk_Canvas) canvasPtr, itemPtr,
587 xOrigin, yOrigin, xScale, yScale);
588 }
589
590 static inline int
591 ItemSelection(
592 TkCanvas *canvasPtr,
593 Tk_Item *itemPtr,
594 int offset,
595 char *buffer,
596 int maxBytes)
597 {
598 if (itemPtr == NULL || itemPtr->typePtr->selectionProc == NULL) {
599 return -1;
600 }
601
602 return itemPtr->typePtr->selectionProc((Tk_Canvas) canvasPtr, itemPtr,
603 offset, buffer, maxBytes);
604 }
605
606 static inline void
607 ItemTranslate(
608 TkCanvas *canvasPtr,
609 Tk_Item *itemPtr,
610 double xDelta,
611 double yDelta)
612 {
613 itemPtr->typePtr->translateProc((Tk_Canvas) canvasPtr, itemPtr,
614 xDelta, yDelta);
615 }
357616
358617 /*
359618 *--------------------------------------------------------------
379638 int argc, /* Number of arguments. */
380639 Tcl_Obj *const argv[]) /* Argument objects. */
381640 {
382 Tk_Window tkwin = (Tk_Window) clientData;
641 Tk_Window tkwin = clientData;
383642 TkCanvas *canvasPtr;
384643 Tk_Window newWin;
385644
408667 canvasPtr->display = Tk_Display(newWin);
409668 canvasPtr->interp = interp;
410669 canvasPtr->widgetCmd = Tcl_CreateObjCommand(interp,
411 Tk_PathName(canvasPtr->tkwin), CanvasWidgetCmd,
412 (ClientData) canvasPtr, CanvasCmdDeletedProc);
670 Tk_PathName(canvasPtr->tkwin), CanvasWidgetCmd, canvasPtr,
671 CanvasCmdDeletedProc);
413672 canvasPtr->firstItemPtr = NULL;
414673 canvasPtr->lastItemPtr = NULL;
415674 canvasPtr->borderWidth = 0;
482741 Tcl_InitHashTable(&canvasPtr->idTable, TCL_ONE_WORD_KEYS);
483742
484743 Tk_SetClass(canvasPtr->tkwin, "Canvas");
485 Tk_SetClassProcs(canvasPtr->tkwin, &canvasClass, (ClientData) canvasPtr);
744 Tk_SetClassProcs(canvasPtr->tkwin, &canvasClass, canvasPtr);
486745 Tk_CreateEventHandler(canvasPtr->tkwin,
487746 ExposureMask|StructureNotifyMask|FocusChangeMask,
488 CanvasEventProc, (ClientData) canvasPtr);
747 CanvasEventProc, canvasPtr);
489748 Tk_CreateEventHandler(canvasPtr->tkwin, KeyPressMask|KeyReleaseMask
490749 |ButtonPressMask|ButtonReleaseMask|EnterWindowMask
491750 |LeaveWindowMask|PointerMotionMask|VirtualEventMask,
492 CanvasBindProc, (ClientData) canvasPtr);
751 CanvasBindProc, canvasPtr);
493752 Tk_CreateSelHandler(canvasPtr->tkwin, XA_PRIMARY, XA_STRING,
494 CanvasFetchSelection, (ClientData) canvasPtr, XA_STRING);
753 CanvasFetchSelection, canvasPtr, XA_STRING);
495754 if (ConfigureCanvas(interp, canvasPtr, argc-2, argv+2, 0) != TCL_OK) {
496755 goto error;
497756 }
498757
499 Tcl_SetResult(interp, Tk_PathName(canvasPtr->tkwin), TCL_STATIC);
758 Tcl_SetObjResult(interp, TkNewWindowObj(canvasPtr->tkwin));
500759 return TCL_OK;
501760
502761 error:
541800 #endif /* USE_OLD_TAG_SEARCH */
542801
543802 int index;
544 static const char *optionStrings[] = {
803 static const char *const optionStrings[] = {
545804 "addtag", "bbox", "bind", "canvasx",
546805 "canvasy", "cget", "configure", "coords",
547806 "create", "dchars", "delete", "dtag",
548807 "find", "focus", "gettags", "icursor",
549 "index", "insert", "itemcget", "itemconfigure",
808 "imove", "index", "insert", "itemcget",
809 "itemconfigure",
550810 "lower", "move", "moveto", "postscript",
551 "raise", "scale", "scan", "select",
552 "type", "xview", "yview",
811 "raise", "rchars", "scale", "scan",
812 "select", "type", "xview", "yview",
553813 NULL
554814 };
555815 enum options {
557817 CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS,
558818 CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG,
559819 CANV_FIND, CANV_FOCUS, CANV_GETTAGS, CANV_ICURSOR,
560 CANV_INDEX, CANV_INSERT, CANV_ITEMCGET, CANV_ITEMCONFIGURE,
820 CANV_IMOVE, CANV_INDEX, CANV_INSERT, CANV_ITEMCGET,
821 CANV_ITEMCONFIGURE,
561822 CANV_LOWER, CANV_MOVE, CANV_MOVETO, CANV_POSTSCRIPT,
562 CANV_RAISE, CANV_SCALE, CANV_SCAN, CANV_SELECT,
563 CANV_TYPE, CANV_XVIEW, CANV_YVIEW
823 CANV_RAISE, CANV_RCHARS, CANV_SCALE, CANV_SCAN,
824 CANV_SELECT, CANV_TYPE, CANV_XVIEW, CANV_YVIEW
564825 };
565826
566827 if (objc < 2) {
571832 &index) != TCL_OK) {
572833 return TCL_ERROR;
573834 }
574 Tcl_Preserve((ClientData) canvasPtr);
835 Tcl_Preserve(canvasPtr);
575836
576837 result = TCL_OK;
577838 switch ((enum options) index) {
581842 result = TCL_ERROR;
582843 goto done;
583844 }
584 #ifdef USE_OLD_TAG_SEARCH
585 result = FindItems(interp, canvasPtr, objc, objv, objv[2], 3);
586 #else /* USE_OLD_TAG_SEARCH */
587 result = FindItems(interp, canvasPtr, objc, objv, objv[2], 3,
588 &searchPtr);
589 #endif /* USE_OLD_TAG_SEARCH */
845 result = FIND_ITEMS(objv[2], 3);
590846 break;
591847
592848 case CANV_BBOX: {
630886 }
631887 }
632888 if (gotAny) {
633 char buf[TCL_INTEGER_SPACE * 4];
634
635 sprintf(buf, "%d %d %d %d", x1, y1, x2, y2);
636 Tcl_SetResult(interp, buf, TCL_VOLATILE);
889 Tcl_Obj *resultObjs[4];
890
891 resultObjs[0] = Tcl_NewIntObj(x1);
892 resultObjs[1] = Tcl_NewIntObj(y1);
893 resultObjs[2] = Tcl_NewIntObj(x2);
894 resultObjs[3] = Tcl_NewIntObj(y2);
895 Tcl_SetObjResult(interp, Tcl_NewListObj(4, resultObjs));
637896 }
638897 break;
639898 }
664923 }
665924 entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, (char *) id);
666925 if (entryPtr != NULL) {
667 itemPtr = (Tk_Item *) Tcl_GetHashValue(entryPtr);
668 object = (ClientData) itemPtr;
926 itemPtr = Tcl_GetHashValue(entryPtr);
927 object = itemPtr;
669928 }
670929
671930 if (object == 0) {
675934 goto done;
676935 }
677936 } else {
678 bindByTag:
679 object = (ClientData) Tk_GetUid(Tcl_GetString(objv[2]));
937 bindByTag:
938 object = Tk_GetUid(Tcl_GetString(objv[2]));
680939 }
681940 #else /* USE_OLD_TAG_SEARCH */
682941 result = TagSearchScan(canvasPtr, objv[2], &searchPtr);
689948 entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable,
690949 (char *) INT2PTR(searchPtr->id));
691950 if (entryPtr != NULL) {
692 itemPtr = (Tk_Item *) Tcl_GetHashValue(entryPtr);
693 object = (ClientData) itemPtr;
951 itemPtr = Tcl_GetHashValue(entryPtr);
952 object = itemPtr;
694953 }
695954
696955 if (object == 0) {
715974 if (objc == 5) {
716975 int append = 0;
717976 unsigned long mask;
718 char* argv4 = Tcl_GetString(objv[4]);
977 char *argv4 = Tcl_GetString(objv[4]);
719978
720979 if (argv4[0] == 0) {
721980 result = Tk_DeleteBinding(interp, canvasPtr->bindingTable,
7841043 command = Tk_GetBinding(interp, canvasPtr->bindingTable,
7851044 object, Tcl_GetString(objv[3]));
7861045 if (command == NULL) {
787 const char *string;
788
789 string = Tcl_GetStringResult(interp);
1046 const char *string = Tcl_GetStringResult(interp);
7901047
7911048 /*
7921049 * Ignore missing binding errors. This is a special hack that
7971054 if (string[0] != '\0') {
7981055 result = TCL_ERROR;
7991056 goto done;
800 } else {
801 Tcl_ResetResult(interp);
8021057 }
1058 Tcl_ResetResult(interp);
8031059 } else {
804 Tcl_SetResult(interp, (char *) command, TCL_STATIC);
1060 Tcl_SetObjResult(interp, Tcl_NewStringObj(command, -1));
8051061 }
8061062 } else {
8071063 Tk_GetAllBindings(interp, canvasPtr->bindingTable, object);
8111067 case CANV_CANVASX: {
8121068 int x;
8131069 double grid;
814 char buf[TCL_DOUBLE_SPACE];
8151070
8161071 if ((objc < 3) || (objc > 4)) {
8171072 Tcl_WrongNumArgs(interp, 2, objv, "screenx ?gridspacing?");
8331088 grid = 0.0;
8341089 }
8351090 x += canvasPtr->xOrigin;
836 Tcl_PrintDouble(interp, GridAlign((double) x, grid), buf);
837 Tcl_SetResult(interp, buf, TCL_VOLATILE);
1091 Tcl_SetObjResult(interp, Tcl_NewDoubleObj(GridAlign((double)x,grid)));
8381092 break;
8391093 }
8401094 case CANV_CANVASY: {
8411095 int y;
8421096 double grid;
843 char buf[TCL_DOUBLE_SPACE];
8441097
8451098 if ((objc < 3) || (objc > 4)) {
8461099 Tcl_WrongNumArgs(interp, 2, objv, "screeny ?gridspacing?");
8621115 grid = 0.0;
8631116 }
8641117 y += canvasPtr->yOrigin;
865 Tcl_PrintDouble(interp, GridAlign((double) y, grid), buf);
866 Tcl_SetResult(interp, buf, TCL_VOLATILE);
1118 Tcl_SetObjResult(interp, Tcl_NewDoubleObj(GridAlign((double)y,grid)));
8671119 break;
8681120 }
8691121 case CANV_CGET:
8961148 FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done);
8971149 if (itemPtr != NULL) {
8981150 if (objc != 3) {
899 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
900 }
901 if (itemPtr->typePtr->coordProc != NULL) {
902 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
903 result = itemPtr->typePtr->coordProc(interp,
904 (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3);
905 } else {
906 const char **args = TkGetStringsFromObjs(objc-3, objv+3);
907
908 result = itemPtr->typePtr->coordProc(interp,
909 (Tk_Canvas) canvasPtr, itemPtr, objc-3,
910 (Tcl_Obj **) args);
911 if (args != NULL) {
912 ckfree((char *) args);
913 }
914 }
915 }
1151 EventuallyRedrawItem(canvasPtr, itemPtr);
1152 }
1153 result = ItemCoords(canvasPtr, itemPtr, objc-3, objv+3);
9161154 if (objc != 3) {
917 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1155 EventuallyRedrawItem(canvasPtr, itemPtr);
9181156 }
9191157 }
9201158 break;
1159 case CANV_IMOVE: {
1160 double ignored;
1161 Tcl_Obj *tmpObj;
1162
1163 if (objc != 6) {
1164 Tcl_WrongNumArgs(interp, 2, objv, "tagOrId index x y");
1165 result = TCL_ERROR;
1166 goto done;
1167 }
1168 if (Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr,
1169 objv[4], &ignored) != TCL_OK
1170 || Tk_CanvasGetCoordFromObj(interp, (Tk_Canvas) canvasPtr,
1171 objv[5], &ignored) != TCL_OK) {
1172 result = TCL_ERROR;
1173 goto done;
1174 }
1175
1176 /*
1177 * Make a temporary object here that we can reuse for all the
1178 * modifications in the loop.
1179 */
1180
1181 tmpObj = Tcl_NewListObj(2, objv+4);
1182
1183 FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) {
1184 int index;
1185 int x1,x2,y1,y2;
1186
1187 /*
1188 * The TK_MOVABLE_POINTS flag should only be set for types that
1189 * support the same semantics of index, dChars and insert methods
1190 * as lines and canvases.
1191 */
1192
1193 if (itemPtr == NULL ||
1194 !(itemPtr->typePtr->alwaysRedraw & TK_MOVABLE_POINTS)) {
1195 continue;
1196 }
1197
1198 result = ItemIndex(canvasPtr, itemPtr, objv[3], &index);
1199 if (result != TCL_OK) {
1200 break;
1201 }
1202
1203 /*
1204 * Redraw both item's old and new areas: it's possible that a
1205 * replace could result in a new area larger than the old area.
1206 * Except if the dCharsProc or insertProc sets the
1207 * TK_ITEM_DONT_REDRAW flag, nothing more needs to be done.
1208 */
1209
1210 x1 = itemPtr->x1; y1 = itemPtr->y1;
1211 x2 = itemPtr->x2; y2 = itemPtr->y2;
1212 itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
1213
1214 ItemDelChars(canvasPtr, itemPtr, index, index);
1215 ItemInsert(canvasPtr, itemPtr, index, tmpObj);
1216
1217 if (!(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW)) {
1218 Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr,
1219 x1, y1, x2, y2);
1220 EventuallyRedrawItem(canvasPtr, itemPtr);
1221 }
1222 itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
1223 }
1224
1225 doneImove:
1226 Tcl_DecrRefCount(tmpObj);
1227 break;
1228 }
9211229 case CANV_CREATE: {
9221230 Tk_ItemType *typePtr;
9231231 Tk_ItemType *matchPtr = NULL;
9241232 Tk_Item *itemPtr;
925 char buf[TCL_INTEGER_SPACE];
9261233 int isNew = 0;
9271234 Tcl_HashEntry *entryPtr;
9281235 char *arg;
9481255 && (!strncmp(arg, typePtr->name, (unsigned)length))) {
9491256 if (matchPtr != NULL) {
9501257 Tcl_MutexUnlock(&typeListMutex);
951 badType:
952 Tcl_AppendResult(interp,
953 "unknown or ambiguous item type \"", arg, "\"",
954 NULL);
955 result = TCL_ERROR;
956 goto done;
1258 goto badType;
9571259 }
9581260 matchPtr = typePtr;
9591261 }
9661268
9671269 Tcl_MutexUnlock(&typeListMutex);
9681270 if (matchPtr == NULL) {
969 goto badType;
1271 badType:
1272 Tcl_AppendResult(interp,
1273 "unknown or ambiguous item type \"", arg, "\"", NULL);
1274 result = TCL_ERROR;
1275 goto done;
9701276 }
9711277 if (objc < 4) {
9721278 /*
9771283 result = TCL_ERROR;
9781284 goto done;
9791285 }
1286
9801287 typePtr = matchPtr;
9811288 itemPtr = (Tk_Item *) ckalloc((unsigned) typePtr->itemSize);
9821289 itemPtr->id = canvasPtr->nextId;
9871294 itemPtr->typePtr = typePtr;
9881295 itemPtr->state = TK_STATE_NULL;
9891296 itemPtr->redraw_flags = 0;
990 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
991 result = typePtr->createProc(interp, (Tk_Canvas) canvasPtr,
992 itemPtr, objc-3, objv+3);
993 } else {
994 const char **args = TkGetStringsFromObjs(objc-3, objv+3);
995
996 result = typePtr->createProc(interp, (Tk_Canvas) canvasPtr,
997 itemPtr, objc-3, (Tcl_Obj **) args);
998 if (args != NULL) {
999 ckfree((char *) args);
1000 }
1001 }
1002 if (result != TCL_OK) {
1297
1298 if (ItemCreate(canvasPtr, itemPtr, objc, objv) != TCL_OK) {
10031299 ckfree((char *) itemPtr);
10041300 result = TCL_ERROR;
10051301 goto done;
10061302 }
1303
10071304 itemPtr->nextPtr = NULL;
10081305 entryPtr = Tcl_CreateHashEntry(&canvasPtr->idTable,
10091306 (char *) INT2PTR(itemPtr->id), &isNew);
10181315 }
10191316 canvasPtr->lastItemPtr = itemPtr;
10201317 itemPtr->redraw_flags |= FORCE_REDRAW;
1021 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1318 EventuallyRedrawItem(canvasPtr, itemPtr);
10221319 canvasPtr->flags |= REPICK_NEEDED;
1023 sprintf(buf, "%d", itemPtr->id);
1024 Tcl_SetResult(interp, buf, TCL_VOLATILE);
1320 Tcl_SetObjResult(interp, Tcl_NewIntObj(itemPtr->id));
10251321 break;
10261322 }
10271323 case CANV_DCHARS: {
10381334 || (itemPtr->typePtr->dCharsProc == NULL)) {
10391335 continue;
10401336 }
1041 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
1042 result = itemPtr->typePtr->indexProc(interp,
1043 (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[3],
1044 &first);
1045 } else {
1046 result = itemPtr->typePtr->indexProc(interp,
1047 (Tk_Canvas) canvasPtr, itemPtr,
1048 Tcl_GetString(objv[3]), &first);
1049 }
1337 result = ItemIndex(canvasPtr, itemPtr, objv[3], &first);
10501338 if (result != TCL_OK) {
10511339 goto done;
10521340 }
10531341 if (objc == 5) {
1054 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
1055 result = itemPtr->typePtr->indexProc(interp,
1056 (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[4],
1057 &last);
1058 } else {
1059 result = itemPtr->typePtr->indexProc(interp,
1060 (Tk_Canvas) canvasPtr, itemPtr,
1061 Tcl_GetString(objv[4]), &last);
1062 }
1342 result = ItemIndex(canvasPtr, itemPtr, objv[4], &last);
10631343 if (result != TCL_OK) {
10641344 goto done;
10651345 }
10771357 x1 = itemPtr->x1; y1 = itemPtr->y1;
10781358 x2 = itemPtr->x2; y2 = itemPtr->y2;
10791359 itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
1080 itemPtr->typePtr->dCharsProc((Tk_Canvas) canvasPtr, itemPtr,
1081 first, last);
1360 ItemDelChars(canvasPtr, itemPtr, first, last);
10821361 if (!(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW)) {
10831362 Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr,
10841363 x1, y1, x2, y2);
1085 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1364 EventuallyRedrawItem(canvasPtr, itemPtr);
10861365 }
10871366 itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
10881367 }
10941373
10951374 for (i = 2; i < objc; i++) {
10961375 FOR_EVERY_CANVAS_ITEM_MATCHING(objv[i], &searchPtr, goto done) {
1097 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1376 EventuallyRedrawItem(canvasPtr, itemPtr);
10981377 if (canvasPtr->bindingTable != NULL) {
1099 Tk_DeleteAllBindings(canvasPtr->bindingTable,
1100 (ClientData) itemPtr);
1378 Tk_DeleteAllBindings(canvasPtr->bindingTable, itemPtr);
11011379 }
1102 itemPtr->typePtr->deleteProc((Tk_Canvas) canvasPtr, itemPtr,
1103 canvasPtr->display);
1380 ItemDelete(canvasPtr, itemPtr);
11041381 if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
11051382 ckfree((char *) itemPtr->tagPtr);
11061383 }
11751452 result = TCL_ERROR;
11761453 goto done;
11771454 }
1178 #ifdef USE_OLD_TAG_SEARCH
1179 result = FindItems(interp, canvasPtr, objc, objv, NULL, 2);
1180 #else /* USE_OLD_TAG_SEARCH */
1181 result = FindItems(interp, canvasPtr, objc, objv, NULL, 2,
1182 &searchPtr);
1183 #endif /* USE_OLD_TAG_SEARCH */
1455 result = FIND_ITEMS(NULL, 2);
11841456 break;
11851457 case CANV_FOCUS:
11861458 if (objc > 3) {
11911463 itemPtr = canvasPtr->textInfo.focusItemPtr;
11921464 if (objc == 2) {
11931465 if (itemPtr != NULL) {
1194 char buf[TCL_INTEGER_SPACE];
1195
1196 sprintf(buf, "%d", itemPtr->id);
1197 Tcl_SetResult(interp, buf, TCL_VOLATILE);
1466 Tcl_SetObjResult(interp, Tcl_NewIntObj(itemPtr->id));
11981467 }
11991468 goto done;
12001469 }
1201 if ((itemPtr != NULL) && (canvasPtr->textInfo.gotFocus)) {
1202 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1470 if (canvasPtr->textInfo.gotFocus) {
1471 EventuallyRedrawItem(canvasPtr, itemPtr);
12031472 }
12041473 if (Tcl_GetString(objv[2])[0] == 0) {
12051474 canvasPtr->textInfo.focusItemPtr = NULL;
12151484 }
12161485 canvasPtr->textInfo.focusItemPtr = itemPtr;
12171486 if (canvasPtr->textInfo.gotFocus) {
1218 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1487 EventuallyRedrawItem(canvasPtr, itemPtr);
12191488 }
12201489 break;
12211490 case CANV_GETTAGS:
12451514 || (itemPtr->typePtr->icursorProc == NULL)) {
12461515 goto done;
12471516 }
1248 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
1249 result = itemPtr->typePtr->indexProc(interp,
1250 (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[3],
1251 &index);
1252 } else {
1253 result = itemPtr->typePtr->indexProc(interp,
1254 (Tk_Canvas) canvasPtr, itemPtr,
1255 Tcl_GetString(objv[3]), &index);
1256 }
1517 result = ItemIndex(canvasPtr, itemPtr, objv[3], &index);
12571518 if (result != TCL_OK) {
12581519 goto done;
12591520 }
1260 itemPtr->typePtr->icursorProc((Tk_Canvas) canvasPtr, itemPtr,
1261 index);
1521 ItemCursor(canvasPtr, itemPtr, index);
12621522 if ((itemPtr == canvasPtr->textInfo.focusItemPtr)
12631523 && (canvasPtr->textInfo.cursorOn)) {
1264 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1524 EventuallyRedrawItem(canvasPtr, itemPtr);
12651525 }
12661526 }
12671527 break;
12681528 }
12691529 case CANV_INDEX: {
12701530 int index;
1271 char buf[TCL_INTEGER_SPACE];
12721531
12731532 if (objc != 4) {
12741533 Tcl_WrongNumArgs(interp, 2, objv, "tagOrId string");
12861545 result = TCL_ERROR;
12871546 goto done;
12881547 }
1289 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
1290 result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas)canvasPtr,
1291 itemPtr, (char *) objv[3], &index);
1292 } else {
1293 result = itemPtr->typePtr->indexProc(interp, (Tk_Canvas)canvasPtr,
1294 itemPtr, Tcl_GetString(objv[3]), &index);
1295 }
1548 result = ItemIndex(canvasPtr, itemPtr, objv[3], &index);
12961549 if (result != TCL_OK) {
12971550 goto done;
12981551 }
1299 sprintf(buf, "%d", index);
1300 Tcl_SetResult(interp, buf, TCL_VOLATILE);
1552 Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
13011553 break;
13021554 }
13031555 case CANV_INSERT: {
13141566 || (itemPtr->typePtr->insertProc == NULL)) {
13151567 continue;
13161568 }
1317 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
1318 result = itemPtr->typePtr->indexProc(interp,
1319 (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[3],
1320 &beforeThis);
1321 } else {
1322 result = itemPtr->typePtr->indexProc(interp,
1323 (Tk_Canvas) canvasPtr, itemPtr,
1324 Tcl_GetString(objv[3]), &beforeThis);
1325 }
1569 result = ItemIndex(canvasPtr, itemPtr, objv[3], &beforeThis);
13261570 if (result != TCL_OK) {
13271571 goto done;
13281572 }
13371581 x1 = itemPtr->x1; y1 = itemPtr->y1;
13381582 x2 = itemPtr->x2; y2 = itemPtr->y2;
13391583 itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
1340 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
1341 itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr,
1342 beforeThis, (char *) objv[4]);
1343 } else {
1344 itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr,
1345 beforeThis, Tcl_GetString(objv[4]));
1346 }
1584 ItemInsert(canvasPtr, itemPtr, beforeThis, objv[4]);
13471585 if (!(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW)) {
13481586 Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr,
13491587 x1, y1, x2, y2);
1350 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1588 EventuallyRedrawItem(canvasPtr, itemPtr);
13511589 }
13521590 itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
13531591 }
13611599 }
13621600 FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done);
13631601 if (itemPtr != NULL) {
1364 result = Tk_ConfigureValue(canvasPtr->interp, canvasPtr->tkwin,
1365 itemPtr->typePtr->configSpecs, (char *) itemPtr,
1366 Tcl_GetString(objv[3]), 0);
1602 result = ItemConfigValue(canvasPtr, itemPtr, objv[3]);
13671603 }
13681604 break;
13691605 case CANV_ITEMCONFIGURE:
13741610 }
13751611 FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
13761612 if (objc == 3) {
1377 result = Tk_ConfigureInfo(canvasPtr->interp, canvasPtr->tkwin,
1378 itemPtr->typePtr->configSpecs, (char *) itemPtr,
1379 NULL, 0);
1613 result = ItemConfigInfo(canvasPtr, itemPtr, NULL);
13801614 } else if (objc == 4) {
1381 result = Tk_ConfigureInfo(canvasPtr->interp, canvasPtr->tkwin,
1382 itemPtr->typePtr->configSpecs, (char *) itemPtr,
1383 Tcl_GetString(objv[3]), 0);
1615 result = ItemConfigInfo(canvasPtr, itemPtr, objv[3]);
13841616 } else {
1385 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1386 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
1387 result = itemPtr->typePtr->configProc(interp,
1388 (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3,
1389 TK_CONFIG_ARGV_ONLY);
1390 } else {
1391 const char **args = TkGetStringsFromObjs(objc-3, objv+3);
1392
1393 result = itemPtr->typePtr->configProc(interp,
1394 (Tk_Canvas) canvasPtr, itemPtr, objc-3,
1395 (Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY);
1396 if (args != NULL) {
1397 ckfree((char *) args);
1398 }
1399 }
1400 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1617 EventuallyRedrawItem(canvasPtr, itemPtr);
1618 result = ItemConfigure(canvasPtr, itemPtr, objc-3, objv+3);
1619 EventuallyRedrawItem(canvasPtr, itemPtr);
14011620 canvasPtr->flags |= REPICK_NEEDED;
14021621 }
14031622 if ((result != TCL_OK) || (objc < 5)) {
14291648 }
14301649 itemPtr = itemPtr->prevPtr;
14311650 }
1432 #ifdef USE_OLD_TAG_SEARCH
1433 RelinkItems(canvasPtr, objv[2], itemPtr);
1434 #else /* USE_OLD_TAG_SEARCH */
1435 result = RelinkItems(canvasPtr, objv[2], itemPtr, &searchPtr);
1436 #endif /* USE_OLD_TAG_SEARCH */
1651 RELINK_ITEMS(objv[2], itemPtr);
14371652 break;
14381653 }
14391654 case CANV_MOVE: {
14511666 goto done;
14521667 }
14531668 FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
1454 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1455 itemPtr->typePtr->translateProc((Tk_Canvas) canvasPtr, itemPtr,
1456 xAmount, yAmount);
1457 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1669 EventuallyRedrawItem(canvasPtr, itemPtr);
1670 ItemTranslate(canvasPtr, itemPtr, xAmount, yAmount);
1671 EventuallyRedrawItem(canvasPtr, itemPtr);
14581672 canvasPtr->flags |= REPICK_NEEDED;
14591673 }
14601674 break;
15141728 */
15151729
15161730 FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
1517 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1518 itemPtr->typePtr->translateProc((Tk_Canvas) canvasPtr,
1519 itemPtr, xAmount, yAmount);
1520 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1731 EventuallyRedrawItem(canvasPtr, itemPtr);
1732 ItemTranslate(canvasPtr, itemPtr, xAmount, yAmount);
1733 EventuallyRedrawItem(canvasPtr, itemPtr);
15211734 canvasPtr->flags |= REPICK_NEEDED;
15221735 }
15231736 }
15591772 goto done;
15601773 }
15611774 }
1562 #ifdef USE_OLD_TAG_SEARCH
1563 RelinkItems(canvasPtr, objv[2], prevPtr);
1564 #else /* USE_OLD_TAG_SEARCH */
1565 result = RelinkItems(canvasPtr, objv[2], prevPtr, &searchPtr);
1566 #endif /* USE_OLD_TAG_SEARCH */
1775 RELINK_ITEMS(objv[2], prevPtr);
1776 break;
1777 }
1778 case CANV_RCHARS: {
1779 int first, last;
1780 int x1,x2,y1,y2;
1781
1782 if (objc != 6) {
1783 Tcl_WrongNumArgs(interp, 2, objv, "tagOrId first last string");
1784 result = TCL_ERROR;
1785 goto done;
1786 }
1787 FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
1788 if ((itemPtr->typePtr->indexProc == NULL)
1789 || (itemPtr->typePtr->dCharsProc == NULL)
1790 || (itemPtr->typePtr->insertProc == NULL)) {
1791 continue;
1792 }
1793 result = ItemIndex(canvasPtr, itemPtr, objv[3], &first);
1794 if (result != TCL_OK) {
1795 goto done;
1796 }
1797 result = ItemIndex(canvasPtr, itemPtr, objv[4], &last);
1798 if (result != TCL_OK) {
1799 goto done;
1800 }
1801
1802 /*
1803 * Redraw both item's old and new areas: it's possible that a
1804 * replace could result in a new area larger than the old area.
1805 * Except if the dCharsProc or insertProc sets the
1806 * TK_ITEM_DONT_REDRAW flag, nothing more needs to be done.
1807 */
1808
1809 x1 = itemPtr->x1; y1 = itemPtr->y1;
1810 x2 = itemPtr->x2; y2 = itemPtr->y2;
1811 itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
1812
1813 ItemDelChars(canvasPtr, itemPtr, first, last);
1814 ItemInsert(canvasPtr, itemPtr, first, objv[5]);
1815
1816 if (!(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW)) {
1817 Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr,
1818 x1, y1, x2, y2);
1819 EventuallyRedrawItem(canvasPtr, itemPtr);
1820 }
1821 itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW;
1822 }
15671823 break;
15681824 }
15691825 case CANV_SCALE: {
15901846 goto done;
15911847 }
15921848 FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
1593 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1594 itemPtr->typePtr->scaleProc((Tk_Canvas) canvasPtr, itemPtr,
1595 xOrigin, yOrigin, xScale, yScale);
1596 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
1849 EventuallyRedrawItem(canvasPtr, itemPtr);
1850 ItemScale(canvasPtr, itemPtr, xOrigin, yOrigin, xScale, yScale);
1851 EventuallyRedrawItem(canvasPtr, itemPtr);
15971852 canvasPtr->flags |= REPICK_NEEDED;
15981853 }
15991854 break;
16001855 }
16011856 case CANV_SCAN: {
16021857 int x, y, gain = 10;
1603 static const char *optionStrings[] = {
1858 static const char *const optionStrings[] = {
16041859 "mark", "dragto", NULL
16051860 };
16061861
16441899 }
16451900 case CANV_SELECT: {
16461901 int index, optionindex;
1647 static const char *optionStrings[] = {
1902 static const char *const optionStrings[] = {
16481903 "adjust", "clear", "from", "item", "to", NULL
16491904 };
16501905 enum options {
16721927 }
16731928 }
16741929 if (objc == 5) {
1675 if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
1676 result = itemPtr->typePtr->indexProc(interp,
1677 (Tk_Canvas) canvasPtr, itemPtr, (char *) objv[4],
1678 &index);
1679 } else {
1680 result = itemPtr->typePtr->indexProc(interp,
1681 (Tk_Canvas) canvasPtr, itemPtr,
1682 Tcl_GetString(objv[4]), &index);
1683 }
1930 result = ItemIndex(canvasPtr, itemPtr, objv[4], &index);
16841931 if (result != TCL_OK) {
16851932 goto done;
16861933 }
17111958 break;
17121959 case CANV_CLEAR:
17131960 if (objc != 3) {
1714 Tcl_AppendResult(interp, 3, objv, NULL);
1961 Tcl_WrongNumArgs(interp, 3, objv, NULL);
17151962 result = TCL_ERROR;
17161963 goto done;
17171964 }
1718 if (canvasPtr->textInfo.selItemPtr != NULL) {
1719 EventuallyRedrawItem((Tk_Canvas) canvasPtr,
1720 canvasPtr->textInfo.selItemPtr);
1721 canvasPtr->textInfo.selItemPtr = NULL;
1722 }
1723 goto done;
1965 EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr);
1966 canvasPtr->textInfo.selItemPtr = NULL;
17241967 break;
17251968 case CANV_FROM:
17261969 if (objc != 5) {
17612004 }
17622005 FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done);
17632006 if (itemPtr != NULL) {
1764 Tcl_SetResult(interp, itemPtr->typePtr->name, TCL_STATIC);
2007 Tcl_SetObjResult(interp,
2008 Tcl_NewStringObj(itemPtr->typePtr->name, -1));
17652009 }
17662010 break;
17672011 case CANV_XVIEW: {
18652109 #ifndef USE_OLD_TAG_SEARCH
18662110 TagSearchDestroy(searchPtr);
18672111 #endif /* not USE_OLD_TAG_SEARCH */
1868 Tcl_Release((ClientData) canvasPtr);
2112 Tcl_Release(canvasPtr);
18692113 return result;
18702114 }
18712115
19042148 for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
19052149 itemPtr = canvasPtr->firstItemPtr) {
19062150 canvasPtr->firstItemPtr = itemPtr->nextPtr;
1907 itemPtr->typePtr->deleteProc((Tk_Canvas) canvasPtr, itemPtr,
1908 canvasPtr->display);
2151 ItemDelete(canvasPtr, itemPtr);
19092152 if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
19102153 ckfree((char *) itemPtr->tagPtr);
19112154 }
20332276 if (argc2 != 4) {
20342277 Tcl_AppendResult(interp, "bad scrollRegion \"",
20352278 canvasPtr->regionString, "\"", NULL);
2036 badRegion:
2279 badRegion:
20372280 ckfree(canvasPtr->regionString);
20382281 ckfree((char *) argv2);
20392282 canvasPtr->regionString = NULL;
20832326 }
20842327
20852328 /*
2086 *---------------------------------------------------------------------------
2329 *----------------------------------------------------------------------
20872330 *
20882331 * CanvasWorldChanged --
20892332 *
20992342 * side effect of causing all the items to recompute their geometry and
21002343 * to be redisplayed.
21012344 *
2102 *---------------------------------------------------------------------------
2345 *----------------------------------------------------------------------
21032346 */
21042347
21052348 static void
21062349 CanvasWorldChanged(
21072350 ClientData instanceData) /* Information about widget. */
21082351 {
2109 TkCanvas *canvasPtr = (TkCanvas *) instanceData;
2352 TkCanvas *canvasPtr = instanceData;
21102353 Tk_Item *itemPtr;
2111 int result;
21122354
21132355 itemPtr = canvasPtr->firstItemPtr;
21142356 for ( ; itemPtr != NULL; itemPtr = itemPtr->nextPtr) {
2115 result = itemPtr->typePtr->configProc(canvasPtr->interp,
2116 (Tk_Canvas) canvasPtr, itemPtr, 0, NULL,
2117 TK_CONFIG_ARGV_ONLY);
2118 if (result != TCL_OK) {
2357 if (ItemConfigure(canvasPtr, itemPtr, 0, NULL) != TCL_OK) {
21192358 Tcl_ResetResult(canvasPtr->interp);
21202359 }
21212360 }
21272366 }
21282367
21292368 /*
2130 *--------------------------------------------------------------
2369 *----------------------------------------------------------------------
21312370 *
21322371 * DisplayCanvas --
21332372 *
21412380 * Side effects:
21422381 * Information appears on the screen.
21432382 *
2144 *--------------------------------------------------------------
2383 *----------------------------------------------------------------------
21452384 */
21462385
21472386 static void
21682407 */
21692408
21702409 while (canvasPtr->flags & REPICK_NEEDED) {
2171 Tcl_Preserve((ClientData) canvasPtr);
2410 Tcl_Preserve(canvasPtr);
21722411 canvasPtr->flags &= ~REPICK_NEEDED;
21732412 PickCurrentItem(canvasPtr, &canvasPtr->pickEvent);
21742413 tkwin = canvasPtr->tkwin;
2175 Tcl_Release((ClientData) canvasPtr);
2414 Tcl_Release(canvasPtr);
21762415 if (tkwin == NULL) {
21772416 return;
21782417 }
21852424 */
21862425
21872426 for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
2188 itemPtr = itemPtr->nextPtr) {
2427 itemPtr = itemPtr->nextPtr) {
21892428 if (itemPtr->redraw_flags & FORCE_REDRAW) {
21902429 itemPtr->redraw_flags &= ~FORCE_REDRAW;
2191 EventuallyRedrawItem((Tk_Canvas)canvasPtr, itemPtr);
2430 EventuallyRedrawItem(canvasPtr, itemPtr);
21922431 itemPtr->redraw_flags &= ~FORCE_REDRAW;
21932432 }
21942433 }
2434
21952435 /*
21962436 * Compute the intersection between the area that needs redrawing and the
21972437 * area that's visible on the screen.
22892529 || (itemPtr->y1 >= screenY2)
22902530 || (itemPtr->x2 < screenX1)
22912531 || (itemPtr->y2 < screenY1)) {
2292 if (!(itemPtr->typePtr->alwaysRedraw & 1)
2532 if (!AlwaysRedraw(itemPtr)
22932533 || (itemPtr->x1 >= canvasPtr->redrawX2)
22942534 || (itemPtr->y1 >= canvasPtr->redrawY2)
22952535 || (itemPtr->x2 < canvasPtr->redrawX1)
22982538 }
22992539 }
23002540 if (itemPtr->state == TK_STATE_HIDDEN ||
2301 (itemPtr->state == TK_STATE_NULL &&
2302 canvasPtr->canvas_state == TK_STATE_HIDDEN)) {
2541 (itemPtr->state == TK_STATE_NULL &&
2542 canvasPtr->canvas_state == TK_STATE_HIDDEN)) {
23032543 continue;
23042544 }
2305 itemPtr->typePtr->displayProc((Tk_Canvas) canvasPtr, itemPtr,
2306 canvasPtr->display, pixmap, screenX1, screenY1, width,
2545 ItemDisplay(canvasPtr, itemPtr, pixmap, screenX1, screenY1, width,
23072546 height);
23082547 }
23092548
23672606 }
23682607
23692608 /*
2370 *--------------------------------------------------------------
2609 *----------------------------------------------------------------------
23712610 *
23722611 * CanvasEventProc --
23732612 *
23782617 * None.
23792618 *
23802619 * Side effects:
2381 * When the window gets deleted, internal structures get cleaned up.
2382 * When it gets exposed, it is redisplayed.
2383 *
2384 *--------------------------------------------------------------
2620 * When the window gets deleted, internal structures get cleaned up. When
2621 * it gets exposed, it is redisplayed.
2622 *
2623 *----------------------------------------------------------------------
23852624 */
23862625
23872626 static void
24142653 canvasPtr->widgetCmd);
24152654 }
24162655 if (canvasPtr->flags & REDRAW_PENDING) {
2417 Tcl_CancelIdleCall(DisplayCanvas, (ClientData) canvasPtr);
2418 }
2419 Tcl_EventuallyFree((ClientData) canvasPtr,
2420 (Tcl_FreeProc *) DestroyCanvas);
2656 Tcl_CancelIdleCall(DisplayCanvas, canvasPtr);
2657 }
2658 Tcl_EventuallyFree(canvasPtr, (Tcl_FreeProc *) DestroyCanvas);
24212659 } else if (eventPtr->type == ConfigureNotify) {
24222660 canvasPtr->flags |= UPDATE_SCROLLBARS;
24232661
24512689
24522690 for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
24532691 itemPtr = itemPtr->nextPtr) {
2454 if (itemPtr->typePtr->alwaysRedraw & 1) {
2455 itemPtr->typePtr->displayProc((Tk_Canvas) canvasPtr, itemPtr,
2456 canvasPtr->display, None, 0, 0, 0, 0);
2692 if (AlwaysRedraw(itemPtr)) {
2693 ItemDisplay(canvasPtr, itemPtr, None, 0, 0, 0, 0);
24572694 }
24582695 }
24592696 }
24982735 }
24992736
25002737 /*
2501 *--------------------------------------------------------------
2738 *----------------------------------------------------------------------
25022739 *
25032740 * Tk_CanvasEventuallyRedraw --
25042741 *
25112748 * Side effects:
25122749 * The screen will eventually be refreshed.
25132750 *
2514 *--------------------------------------------------------------
2751 *----------------------------------------------------------------------
25152752 */
25162753
25172754 void
25602797 canvasPtr->flags |= BBOX_NOT_EMPTY;
25612798 }
25622799 if (!(canvasPtr->flags & REDRAW_PENDING)) {
2563 Tcl_DoWhenIdle(DisplayCanvas, (ClientData) canvasPtr);
2800 Tcl_DoWhenIdle(DisplayCanvas, canvasPtr);
25642801 canvasPtr->flags |= REDRAW_PENDING;
25652802 }
25662803 }
25672804
25682805 /*
2569 *--------------------------------------------------------------
2806 *----------------------------------------------------------------------
25702807 *
25712808 * EventuallyRedrawItem --
25722809 *
25792816 * Side effects:
25802817 * The screen will eventually be refreshed.
25812818 *
2582 *--------------------------------------------------------------
2819 *----------------------------------------------------------------------
25832820 */
25842821
25852822 static void
25862823 EventuallyRedrawItem(
2587 Tk_Canvas canvas, /* Information about widget. */
2588 Tk_Item *itemPtr) /* Item to be redrawn. */
2589 {
2590 TkCanvas *canvasPtr = Canvas(canvas);
2591
2824 TkCanvas *canvasPtr, /* Information about widget. */
2825 Tk_Item *itemPtr) /* Item to be redrawn. May be NULL, in which
2826 * case nothing happens. */
2827 {
2828 if (itemPtr == NULL) {
2829 return;
2830 }
25922831 if ((itemPtr->x1 >= itemPtr->x2) || (itemPtr->y1 >= itemPtr->y2) ||
25932832 (itemPtr->x2 < canvasPtr->xOrigin) ||
25942833 (itemPtr->y2 < canvasPtr->yOrigin) ||
25952834 (itemPtr->x1 >= canvasPtr->xOrigin+Tk_Width(canvasPtr->tkwin)) ||
25962835 (itemPtr->y1 >= canvasPtr->yOrigin+Tk_Height(canvasPtr->tkwin))) {
2597 if (!(itemPtr->typePtr->alwaysRedraw & 1)) {
2836 if (!AlwaysRedraw(itemPtr)) {
25982837 return;
25992838 }
26002839 }
26222861 itemPtr->redraw_flags |= FORCE_REDRAW;
26232862 }
26242863 if (!(canvasPtr->flags & REDRAW_PENDING)) {
2625 Tcl_DoWhenIdle(DisplayCanvas, (ClientData) canvasPtr);
2864 Tcl_DoWhenIdle(DisplayCanvas, canvasPtr);
26262865 canvasPtr->flags |= REDRAW_PENDING;
26272866 }
26282867 }
26292868
26302869 /*
2631 *--------------------------------------------------------------
2870 *----------------------------------------------------------------------
26322871 *
26332872 * Tk_CreateItemType --
26342873 *
26442883 * commands). If there was already a type with the same name as in
26452884 * typePtr, it is replaced with the new type.
26462885 *
2647 *--------------------------------------------------------------
2886 *----------------------------------------------------------------------
26482887 */
26492888
26502889 void
27843023 Tk_Uid uid;
27853024 char *tag = Tcl_GetString(tagObj);
27863025 int count;
2787 TkWindow *tkwin;
2788 TkDisplay *dispPtr;
2789
2790 tkwin = (TkWindow *) canvasPtr->tkwin;
2791 dispPtr = tkwin->dispPtr;
3026 TkWindow *tkwin = (TkWindow *) canvasPtr->tkwin;
3027 TkDisplay *dispPtr = tkwin->dispPtr;
27923028
27933029 /*
27943030 * Initialize the search.
28183054 dispPtr->numSlowSearches++;
28193055 entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, (char*) id);
28203056 if (entryPtr != NULL) {
2821 itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr);
3057 itemPtr = Tcl_GetHashValue(entryPtr);
28223058 lastPtr = itemPtr->prevPtr;
28233059 } else {
28243060 lastPtr = itemPtr = NULL;
30103246 TagSearchExprInit(
30113247 TagSearchExpr **exprPtrPtr)
30123248 {
3013 TagSearchExpr* expr = *exprPtrPtr;
3014
3015 if (! expr) {
3249 TagSearchExpr *expr = *exprPtrPtr;
3250
3251 if (expr == NULL) {
30163252 expr = (TagSearchExpr *) ckalloc(sizeof(TagSearchExpr));
30173253 expr->allocated = 0;
30183254 expr->uids = NULL;
30423278 TagSearchExprDestroy(
30433279 TagSearchExpr *expr)
30443280 {
3045 if (expr) {
3281 if (expr != NULL) {
30463282 if (expr->uids) {
3047 ckfree((char *)expr->uids);
3048 }
3049 ckfree((char *)expr);
3283 ckfree((char *) expr->uids);
3284 }
3285 ckfree((char *) expr);
30503286 }
30513287 }
30523288
30873323 * Initialize the search.
30883324 */
30893325
3090 if (*searchPtrPtr) {
3326 if (*searchPtrPtr != NULL) {
30913327 searchPtr = *searchPtrPtr;
30923328 } else {
30933329 /*
31043340 searchPtr->rewritebufferAllocated = 100;
31053341 searchPtr->rewritebuffer = ckalloc(searchPtr->rewritebufferAllocated);
31063342 }
3107 TagSearchExprInit(&(searchPtr->expr));
3343 TagSearchExprInit(&searchPtr->expr);
31083344
31093345 /*
31103346 * How long is the tagOrId?
31163352 * Make sure there is enough buffer to hold rewritten tags.
31173353 */
31183354
3119 if ((unsigned int)searchPtr->stringLength >=
3355 if ((unsigned) searchPtr->stringLength >=
31203356 searchPtr->rewritebufferAllocated) {
31213357 searchPtr->rewritebufferAllocated = searchPtr->stringLength + 100;
31223358 searchPtr->rewritebuffer =
32483484 {
32493485 if (searchPtr) {
32503486 TagSearchExprDestroy(searchPtr->expr);
3251 ckfree((char *)searchPtr->rewritebuffer);
3252 ckfree((char *)searchPtr);
3487 ckfree((char *) searchPtr->rewritebuffer);
3488 ckfree((char *) searchPtr);
32533489 }
32543490 }
32553491
35943830 negate_result = 0;
35953831 }
35963832 looking_for_tag = 0;
3597 } else { /* ! looking_for_tag */
3833 } else { /* ! looking_for_tag */
35983834 if (((uid == searchUids->andUid) && (!result)) ||
35993835 ((uid == searchUids->orUid) && result)) {
36003836 /*
37003936 entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable,
37013937 (char *) INT2PTR(searchPtr->id));
37023938 if (entryPtr != NULL) {
3703 itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr);
3939 itemPtr = Tcl_GetHashValue(entryPtr);
37043940 lastPtr = itemPtr->prevPtr;
37053941 } else {
37063942 lastPtr = itemPtr = NULL;
39234159
39244160 itemPtr->tagSpace += 5;
39254161 newTagPtr = (Tk_Uid *)
3926 ckalloc((unsigned) (itemPtr->tagSpace * sizeof(Tk_Uid)));
4162 ckalloc((unsigned) itemPtr->tagSpace * sizeof(Tk_Uid));
39274163 memcpy((void *) newTagPtr, itemPtr->tagPtr,
39284164 itemPtr->numTags * sizeof(Tk_Uid));
39294165 if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
39914227 Tk_Item *itemPtr;
39924228 Tk_Uid uid;
39934229 int index, result;
3994 static const char *optionStrings[] = {
4230 static const char *const optionStrings[] = {
39954231 "above", "all", "below", "closest",
39964232 "enclosed", "overlapping", "withtag", NULL
39974233 };
41114347 if (itemPtr == NULL) {
41124348 return TCL_OK;
41134349 }
4114 closestDist = itemPtr->typePtr->pointProc((Tk_Canvas) canvasPtr,
4115 itemPtr, coords) - halo;
4116 if (closestDist < 0.0) {
4117 closestDist = 0.0;
4118 }
4350 closestDist = ItemPoint(canvasPtr, itemPtr, coords, halo);
41194351 while (1) {
41204352 double newDist;
41214353
41544386 || (itemPtr->y1 >= y2) || (itemPtr->y2 <= y1)) {
41554387 continue;
41564388 }
4157 newDist = itemPtr->typePtr->pointProc((Tk_Canvas) canvasPtr,
4158 itemPtr, coords) - halo;
4159 if (newDist < 0.0) {
4160 newDist = 0.0;
4161 }
4389 newDist = ItemPoint(canvasPtr, itemPtr, coords, halo);
41624390 if (newDist <= closestDist) {
41634391 closestDist = newDist;
41644392 break;
42704498 || (itemPtr->y1 >= y2) || (itemPtr->y2 <= y1)) {
42714499 continue;
42724500 }
4273 if (itemPtr->typePtr->areaProc((Tk_Canvas) canvasPtr, itemPtr, rect)
4274 >= enclosed) {
4501 if (ItemOverlap(canvasPtr, itemPtr, rect) >= enclosed) {
42754502 DoItem(interp, itemPtr, uid);
42764503 }
42774504 }
43634590 lastMovePtr->nextPtr = itemPtr;
43644591 }
43654592 lastMovePtr = itemPtr;
4366 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
4593 EventuallyRedrawItem(canvasPtr, itemPtr);
43674594 canvasPtr->flags |= REPICK_NEEDED;
43684595 }
43694596
44274654 XEvent *eventPtr) /* Pointer to X event that just happened. */
44284655 {
44294656 TkCanvas *canvasPtr = clientData;
4657 int mask;
44304658
44314659 Tcl_Preserve(canvasPtr);
44324660
44364664 * current item while buttons are down.
44374665 */
44384666
4439 if (eventPtr->type == ButtonPress || eventPtr->type == ButtonRelease) {
4440 int mask;
4441
4667 switch (eventPtr->type) {
4668 case ButtonPress:
4669 case ButtonRelease:
44424670 switch (eventPtr->xbutton.button) {
44434671 case Button1:
44444672 mask = Button1Mask;
44924720 PickCurrentItem(canvasPtr, eventPtr);
44934721 eventPtr->xbutton.state ^= mask;
44944722 }
4495 goto done;
4496 } else if ((eventPtr->type == EnterNotify)
4497 || (eventPtr->type == LeaveNotify)) {
4723 break;
4724 case EnterNotify:
4725 case LeaveNotify:
44984726 canvasPtr->state = eventPtr->xcrossing.state;
44994727 PickCurrentItem(canvasPtr, eventPtr);
4500 goto done;
4501 } else if (eventPtr->type == MotionNotify) {
4728 break;
4729 case MotionNotify:
45024730 canvasPtr->state = eventPtr->xmotion.state;
45034731 PickCurrentItem(canvasPtr, eventPtr);
4504 }
4505 CanvasDoEvent(canvasPtr, eventPtr);
4506
4507 done:
4732 /* fallthrough */
4733 default:
4734 CanvasDoEvent(canvasPtr, eventPtr);
4735 }
4736
45084737 Tcl_Release(canvasPtr);
45094738 }
45104739
47024931 canvasPtr->currentItemPtr = canvasPtr->newCurrentPtr;
47034932 if (prevItemPtr != NULL && prevItemPtr != canvasPtr->currentItemPtr &&
47044933 (prevItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT)) {
4705 EventuallyRedrawItem((Tk_Canvas) canvasPtr, prevItemPtr);
4706 prevItemPtr->typePtr->configProc(canvasPtr->interp,
4707 (Tk_Canvas) canvasPtr, prevItemPtr, 0, NULL,
4708 TK_CONFIG_ARGV_ONLY);
4934 EventuallyRedrawItem(canvasPtr, prevItemPtr);
4935 ItemConfigure(canvasPtr, prevItemPtr, 0, NULL);
47094936 }
47104937 if (canvasPtr->currentItemPtr != NULL) {
47114938 XEvent event;
47144941 DoItem(NULL, canvasPtr->currentItemPtr, Tk_GetUid("current"));
47154942 #else /* USE_OLD_TAG_SEARCH */
47164943 DoItem(NULL, canvasPtr->currentItemPtr, searchUids->currentUid);
4717 #endif /* USE_OLD_TAG_SEA */
4944 #endif /* USE_OLD_TAG_SEARCH */
47184945 if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT
47194946 && prevItemPtr != canvasPtr->currentItemPtr)) {
4720 canvasPtr->currentItemPtr->typePtr->configProc(canvasPtr->interp,
4721 (Tk_Canvas) canvasPtr, canvasPtr->currentItemPtr, 0, NULL,
4722 TK_CONFIG_ARGV_ONLY);
4723 EventuallyRedrawItem((Tk_Canvas) canvasPtr,
4724 canvasPtr->currentItemPtr);
4947 ItemConfigure(canvasPtr, canvasPtr->currentItemPtr, 0, NULL);
4948 EventuallyRedrawItem(canvasPtr, canvasPtr->currentItemPtr);
47254949 }
47264950 event = canvasPtr->pickEvent;
47274951 event.type = EnterNotify;
47785002 || (itemPtr->y1 > y2) || (itemPtr->y2 < y1)) {
47795003 continue;
47805004 }
4781 if (itemPtr->typePtr->pointProc((Tk_Canvas) canvasPtr, itemPtr,
4782 coords) <= canvasPtr->closeEnough) {
5005 if (ItemPoint(canvasPtr,itemPtr,coords,0) <= canvasPtr->closeEnough) {
47835006 bestPtr = itemPtr;
47845007 }
47855008 }
49545177 canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
49555178 canvasPtr->insertOnTime, CanvasBlinkProc, canvasPtr);
49565179 }
4957 if (canvasPtr->textInfo.focusItemPtr != NULL) {
4958 EventuallyRedrawItem((Tk_Canvas) canvasPtr,
4959 canvasPtr->textInfo.focusItemPtr);
4960 }
5180 EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.focusItemPtr);
49615181 }
49625182
49635183 /*
49975217 canvasPtr->textInfo.cursorOn = 0;
49985218 canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
49995219 }
5000 if (canvasPtr->textInfo.focusItemPtr != NULL) {
5001 EventuallyRedrawItem((Tk_Canvas) canvasPtr,
5002 canvasPtr->textInfo.focusItemPtr);
5003 }
5220 EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.focusItemPtr);
50045221 if (canvasPtr->highlightWidth > 0) {
50055222 canvasPtr->flags |= REDRAW_BORDERS;
50065223 if (!(canvasPtr->flags & REDRAW_PENDING)) {
50495266 Tk_OwnSelection(canvasPtr->tkwin, XA_PRIMARY, CanvasLostSelection,
50505267 canvasPtr);
50515268 } else if (canvasPtr->textInfo.selItemPtr != itemPtr) {
5052 EventuallyRedrawItem((Tk_Canvas) canvasPtr,
5053 canvasPtr->textInfo.selItemPtr);
5269 EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr);
50545270 }
50555271 canvasPtr->textInfo.selItemPtr = itemPtr;
50565272
50685284 if ((canvasPtr->textInfo.selectFirst != oldFirst)
50695285 || (canvasPtr->textInfo.selectLast != oldLast)
50705286 || (itemPtr != oldSelPtr)) {
5071 EventuallyRedrawItem((Tk_Canvas) canvasPtr, itemPtr);
5287 EventuallyRedrawItem(canvasPtr, itemPtr);
50725288 }
50735289 }
50745290
51055321 {
51065322 TkCanvas *canvasPtr = clientData;
51075323
5108 if (canvasPtr->textInfo.selItemPtr == NULL) {
5109 return -1;
5110 }
5111 if (canvasPtr->textInfo.selItemPtr->typePtr->selectionProc == NULL) {
5112 return -1;
5113 }
5114 return canvasPtr->textInfo.selItemPtr->typePtr->selectionProc(
5115 (Tk_Canvas) canvasPtr, canvasPtr->textInfo.selItemPtr, offset,
5324 return ItemSelection(canvasPtr, canvasPtr->textInfo.selItemPtr, offset,
51165325 buffer, maxBytes);
51175326 }
51185327
51405349 {
51415350 TkCanvas *canvasPtr = clientData;
51425351
5143 if (canvasPtr->textInfo.selItemPtr != NULL) {
5144 EventuallyRedrawItem((Tk_Canvas) canvasPtr,
5145 canvasPtr->textInfo.selItemPtr);
5146 }
5352 EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr);
51475353 canvasPtr->textInfo.selItemPtr = NULL;
51485354 }
51495355
52945500 NULL);
52955501 Tcl_DecrRefCount(fractions);
52965502 if (result != TCL_OK) {
5297 Tcl_BackgroundError(interp);
5503 Tcl_BackgroundException(interp, result);
52985504 }
52995505 Tcl_ResetResult(interp);
53005506 Tcl_Release(xScrollCmd);
53085514 NULL);
53095515 Tcl_DecrRefCount(fractions);
53105516 if (result != TCL_OK) {
5311 Tcl_BackgroundError(interp);
5517 Tcl_BackgroundException(interp, result);
53125518 }
53135519 Tcl_ResetResult(interp);
53145520 Tcl_Release(yScrollCmd);
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkClipboard.c,v 1.20 2008/07/23 23:24:23 nijtmans Exp $
13 * RCS: @(#) $Id: tkClipboard.c,v 1.22 2008/10/28 22:33:06 nijtmans Exp $
1414 */
1515
1616 #include "tkInt.h"
2828 int offset, char *buffer, int maxBytes);
2929 static void ClipboardLostSel(ClientData clientData);
3030 static int ClipboardGetProc(ClientData clientData,
31 Tcl_Interp *interp, char *portion);
31 Tcl_Interp *interp, const char *portion);
3232
3333 /*
3434 *----------------------------------------------------------------------
424424 Tk_Window tkwin = (Tk_Window) clientData;
425425 char *path = NULL;
426426 Atom selection;
427 static const char *optionStrings[] = { "append", "clear", "get", NULL };
427 static const char *const optionStrings[] = { "append", "clear", "get", NULL };
428428 enum options { CLIPBOARD_APPEND, CLIPBOARD_CLEAR, CLIPBOARD_GET };
429429 int index, i;
430430
444444 char *targetName = NULL;
445445 char *formatName = NULL;
446446 char *string;
447 static const char *appendOptionStrings[] = {
447 static const char *const appendOptionStrings[] = {
448448 "-displayof", "-format", "-type", NULL
449449 };
450450 enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE };
515515 Tcl_GetString(objv[i]));
516516 }
517517 case CLIPBOARD_CLEAR: {
518 static const char *clearOptionStrings[] = { "-displayof", NULL };
518 static const char *const clearOptionStrings[] = { "-displayof", NULL };
519519 enum clearOptions { CLEAR_DISPLAYOF };
520520 int subIndex;
521521
547547 Tcl_DString selBytes;
548548 int result;
549549 char *string;
550 static const char *getOptionStrings[] = {
550 static const char *const getOptionStrings[] = {
551551 "-displayof", "-type", NULL
552552 };
553553 enum getOptions { APPEND_DISPLAYOF, APPEND_TYPE };
703703 * selection. */
704704 Tcl_Interp *interp, /* Interpreter used for error reporting (not
705705 * used). */
706 char *portion) /* New information to be appended. */
706 const char *portion) /* New information to be appended. */
707707 {
708708 Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1);
709709 return TCL_OK;
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkCmds.c,v 1.44 2008/10/05 21:25:07 dkf Exp $
13 * RCS: @(#) $Id: tkCmds.c,v 1.49 2008/12/10 05:02:40 das Exp $
1414 */
1515
1616 #include "tkInt.h"
3535 XEvent *eventPtr);
3636 static void WaitWindowProc(ClientData clientData,
3737 XEvent *eventPtr);
38 static int AppnameCmd(ClientData dummy, Tcl_Interp *interp,
39 int objc, Tcl_Obj *const *objv);
40 static int CaretCmd(ClientData dummy, Tcl_Interp *interp,
41 int objc, Tcl_Obj *const *objv);
42 static int InactiveCmd(ClientData dummy, Tcl_Interp *interp,
43 int objc, Tcl_Obj *const *objv);
44 static int ScalingCmd(ClientData dummy, Tcl_Interp *interp,
45 int objc, Tcl_Obj *const *objv);
46 static int UseinputmethodsCmd(ClientData dummy,
47 Tcl_Interp *interp, int objc,
48 Tcl_Obj *const *objv);
49 static int WindowingsystemCmd(ClientData dummy,
50 Tcl_Interp *interp, int objc,
51 Tcl_Obj *const *objv);
52
53 #if defined(__WIN32__) || defined(MAC_OSX_TK)
54 MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[];
55 #else
56 #define tkFontchooserEnsemble NULL
57 #endif
58
59 /*
60 * Table of tk subcommand names and implementations.
61 */
62
63 static const TkEnsemble tkCmdMap[] = {
64 {"appname", AppnameCmd },
65 {"busy", Tk_BusyObjCmd },
66 {"caret", CaretCmd },
67 {"inactive", InactiveCmd },
68 {"scaling", ScalingCmd },
69 {"useinputmethods", UseinputmethodsCmd },
70 {"windowingsystem", WindowingsystemCmd },
71 {"fontchooser", NULL, tkFontchooserEnsemble},
72 {NULL}
73 };
3874
3975 /*
4076 *----------------------------------------------------------------------
6096 int objc, /* Number of arguments. */
6197 Tcl_Obj *const objv[]) /* Argument objects. */
6298 {
63 static const char *bellOptions[] = {
99 static const char *const bellOptions[] = {
64100 "-displayof", "-nice", NULL
65101 };
66102 enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE };
586622 }
587623
588624 /*
589 *----------------------------------------------------------------------
590 *
591 * Tk_TkObjCmd --
592 *
593 * This function is invoked to process the "tk" Tcl command. See the user
594 * documentation for details on what it does.
625 * ----------------------------------------------------------------------
626 *
627 * TkInitTkCmd --
628 *
629 * Set up the tk ensemble.
595630 *
596631 * Results:
597632 * A standard Tcl result.
598633 *
599634 * Side effects:
635 * None.
636 *
637 * ----------------------------------------------------------------------
638 */
639
640 int
641 TkInitTkCmd(Tcl_Interp *interp, ClientData clientData)
642 {
643 TkMakeEnsemble(interp, "::", "tk", clientData, tkCmdMap);
644 #if defined(__WIN32__) || defined(MAC_OSX_TK)
645 TkInitFontchooser(interp, clientData);
646 #endif
647 return TCL_OK;
648 }
649
650 /*
651 *----------------------------------------------------------------------
652 *
653 * AppnameCmd, CaretCmd, ScalingCmd, UseinputmethodsCmd,
654 * WindowingsystemCmd, InactiveCmd --
655 *
656 * These functions are invoked to process the "tk" ensemble subcommands.
657 * See the user documentation for details on what they do.
658 *
659 * Results:
660 * A standard Tcl result.
661 *
662 * Side effects:
600663 * See the user documentation.
601664 *
602665 *----------------------------------------------------------------------
603666 */
604667
605668 int
606 Tk_TkObjCmd(
669 AppnameCmd(
607670 ClientData clientData, /* Main window associated with interpreter. */
608671 Tcl_Interp *interp, /* Current interpreter. */
609672 int objc, /* Number of arguments. */
610673 Tcl_Obj *const objv[]) /* Argument objects. */
611674 {
675 Tk_Window tkwin = clientData;
676 TkWindow *winPtr;
677 char *string;
678
679 if (Tcl_IsSafe(interp)) {
680 Tcl_SetResult(interp,
681 "appname not accessible in a safe interpreter",
682 TCL_STATIC);
683 return TCL_ERROR;
684 }
685
686 winPtr = (TkWindow *) tkwin;
687
688 if (objc > 2) {
689 Tcl_WrongNumArgs(interp, 1, objv, "?newName?");
690 return TCL_ERROR;
691 }
692 if (objc == 2) {
693 string = Tcl_GetString(objv[1]);
694 winPtr->nameUid = Tk_GetUid(Tk_SetAppName(tkwin, string));
695 }
696 Tcl_AppendResult(interp, winPtr->nameUid, NULL);
697 return TCL_OK;
698 }
699
700 int
701 CaretCmd(
702 ClientData clientData, /* Main window associated with interpreter. */
703 Tcl_Interp *interp, /* Current interpreter. */
704 int objc, /* Number of arguments. */
705 Tcl_Obj *const objv[]) /* Argument objects. */
706 {
707 Tk_Window tkwin = clientData;
612708 int index;
613 Tk_Window tkwin;
614 static const char *optionStrings[] = {
615 "appname", "caret", "scaling", "useinputmethods",
616 "windowingsystem", "inactive", NULL
709 Tcl_Obj *objPtr;
710 TkCaret *caretPtr;
711 Tk_Window window;
712 static const char *const caretStrings[] = {
713 "-x", "-y", "-height", NULL
617714 };
618 enum options {
619 TK_APPNAME, TK_CARET, TK_SCALING, TK_USE_IM,
620 TK_WINDOWINGSYSTEM, TK_INACTIVE
715 enum caretOptions {
716 TK_CARET_X, TK_CARET_Y, TK_CARET_HEIGHT
621717 };
622718
623 tkwin = (Tk_Window) clientData;
624
625 if (objc < 2) {
626 Tcl_WrongNumArgs(interp, 1, objv, "option ?arg?");
627 return TCL_ERROR;
628 }
629 if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
630 &index) != TCL_OK) {
631 return TCL_ERROR;
632 }
633
634 switch ((enum options) index) {
635 case TK_APPNAME: {
636 TkWindow *winPtr;
637 char *string;
638
639 if (Tcl_IsSafe(interp)) {
640 Tcl_SetResult(interp,
641 "appname not accessible in a safe interpreter",
642 TCL_STATIC);
643 return TCL_ERROR;
644 }
645
646 winPtr = (TkWindow *) tkwin;
647
648 if (objc > 3) {
649 Tcl_WrongNumArgs(interp, 2, objv, "?newName?");
650 return TCL_ERROR;
651 }
652 if (objc == 3) {
653 string = Tcl_GetString(objv[2]);
654 winPtr->nameUid = Tk_GetUid(Tk_SetAppName(tkwin, string));
655 }
656 Tcl_AppendResult(interp, winPtr->nameUid, NULL);
657 break;
658 }
659 case TK_CARET: {
660 Tcl_Obj *objPtr;
661 TkCaret *caretPtr;
662 Tk_Window window;
663 static const char *caretStrings[] = {
664 "-x", "-y", "-height", NULL
665 };
666 enum caretOptions {
667 TK_CARET_X, TK_CARET_Y, TK_CARET_HEIGHT
668 };
669
670 if ((objc < 3) || ((objc > 4) && !(objc & 1))) {
671 Tcl_WrongNumArgs(interp, 2, objv,
672 "window ?-x x? ?-y y? ?-height height?");
673 return TCL_ERROR;
674 }
675 window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
676 if (window == NULL) {
677 return TCL_ERROR;
678 }
679 caretPtr = &(((TkWindow *) window)->dispPtr->caret);
680 if (objc == 3) {
681 /*
682 * Return all the current values
683 */
684
685 objPtr = Tcl_NewObj();
686 Tcl_ListObjAppendElement(interp, objPtr,
687 Tcl_NewStringObj("-height", 7));
688 Tcl_ListObjAppendElement(interp, objPtr,
689 Tcl_NewIntObj(caretPtr->height));
690 Tcl_ListObjAppendElement(interp, objPtr,
691 Tcl_NewStringObj("-x", 2));
692 Tcl_ListObjAppendElement(interp, objPtr,
693 Tcl_NewIntObj(caretPtr->x));
694 Tcl_ListObjAppendElement(interp, objPtr,
695 Tcl_NewStringObj("-y", 2));
696 Tcl_ListObjAppendElement(interp, objPtr,
697 Tcl_NewIntObj(caretPtr->y));
698 Tcl_SetObjResult(interp, objPtr);
699 } else if (objc == 4) {
700 int value;
701
702 /*
703 * Return the current value of the selected option
704 */
705
706 if (Tcl_GetIndexFromObj(interp, objv[3], caretStrings,
707 "caret option", 0, &index) != TCL_OK) {
719 if ((objc < 2) || ((objc > 3) && !!(objc & 1))) {
720 Tcl_WrongNumArgs(interp, 1, objv,
721 "window ?-x x? ?-y y? ?-height height?");
722 return TCL_ERROR;
723 }
724 window = Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin);
725 if (window == NULL) {
726 return TCL_ERROR;
727 }
728 caretPtr = &(((TkWindow *) window)->dispPtr->caret);
729 if (objc == 2) {
730 /*
731 * Return all the current values
732 */
733
734 objPtr = Tcl_NewObj();
735 Tcl_ListObjAppendElement(interp, objPtr,
736 Tcl_NewStringObj("-height", 7));
737 Tcl_ListObjAppendElement(interp, objPtr,
738 Tcl_NewIntObj(caretPtr->height));
739 Tcl_ListObjAppendElement(interp, objPtr,
740 Tcl_NewStringObj("-x", 2));
741 Tcl_ListObjAppendElement(interp, objPtr,
742 Tcl_NewIntObj(caretPtr->x));
743 Tcl_ListObjAppendElement(interp, objPtr,
744 Tcl_NewStringObj("-y", 2));
745 Tcl_ListObjAppendElement(interp, objPtr,
746 Tcl_NewIntObj(caretPtr->y));
747 Tcl_SetObjResult(interp, objPtr);
748 } else if (objc == 3) {
749 int value;
750
751 /*
752 * Return the current value of the selected option
753 */
754
755 if (Tcl_GetIndexFromObj(interp, objv[2], caretStrings,
756 "caret option", 0, &index) != TCL_OK) {
757 return TCL_ERROR;
758 }
759 if (index == TK_CARET_X) {
760 value = caretPtr->x;
761 } else if (index == TK_CARET_Y) {
762 value = caretPtr->y;
763 } else /* if (index == TK_CARET_HEIGHT) -- last case */ {
764 value = caretPtr->height;
765 }
766 Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
767 } else {
768 int i, value, x = 0, y = 0, height = -1;
769
770 for (i = 2; i < objc; i += 2) {
771 if ((Tcl_GetIndexFromObj(interp, objv[i], caretStrings,
772 "caret option", 0, &index) != TCL_OK) ||
773 Tcl_GetIntFromObj(interp,objv[i+1],&value) != TCL_OK) {
708774 return TCL_ERROR;
709775 }
710776 if (index == TK_CARET_X) {
711 value = caretPtr->x;
777 x = value;
712778 } else if (index == TK_CARET_Y) {
713 value = caretPtr->y;
779 y = value;
714780 } else /* if (index == TK_CARET_HEIGHT) -- last case */ {
715 value = caretPtr->height;
781 height = value;
716782 }
717 Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
783 }
784 if (height < 0) {
785 height = Tk_Height(window);
786 }
787 Tk_SetCaretPos(window, x, y, height);
788 }
789 return TCL_OK;
790 }
791
792 int
793 ScalingCmd(
794 ClientData clientData, /* Main window associated with interpreter. */
795 Tcl_Interp *interp, /* Current interpreter. */
796 int objc, /* Number of arguments. */
797 Tcl_Obj *const objv[]) /* Argument objects. */
798 {
799 Tk_Window tkwin = clientData;
800 Screen *screenPtr;
801 int skip, width, height;
802 double d;
803
804 if (Tcl_IsSafe(interp)) {
805 Tcl_SetResult(interp,
806 "scaling not accessible in a safe interpreter",
807 TCL_STATIC);
808 return TCL_ERROR;
809 }
810
811 skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
812 if (skip < 0) {
813 return TCL_ERROR;
814 }
815 screenPtr = Tk_Screen(tkwin);
816 if (objc - skip == 1) {
817 d = 25.4 / 72;
818 d *= WidthOfScreen(screenPtr);
819 d /= WidthMMOfScreen(screenPtr);
820 Tcl_SetObjResult(interp, Tcl_NewDoubleObj(d));
821 } else if (objc - skip == 2) {
822 if (Tcl_GetDoubleFromObj(interp, objv[1+skip], &d) != TCL_OK) {
823 return TCL_ERROR;
824 }
825 d = (25.4 / 72) / d;
826 width = (int) (d * WidthOfScreen(screenPtr) + 0.5);
827 if (width <= 0) {
828 width = 1;
829 }
830 height = (int) (d * HeightOfScreen(screenPtr) + 0.5);
831 if (height <= 0) {
832 height = 1;
833 }
834 WidthMMOfScreen(screenPtr) = width;
835 HeightMMOfScreen(screenPtr) = height;
836 } else {
837 Tcl_WrongNumArgs(interp, 1, objv,
838 "?-displayof window? ?factor?");
839 return TCL_ERROR;
840 }
841 return TCL_OK;
842 }
843
844 int
845 UseinputmethodsCmd(
846 ClientData clientData, /* Main window associated with interpreter. */
847 Tcl_Interp *interp, /* Current interpreter. */
848 int objc, /* Number of arguments. */
849 Tcl_Obj *const objv[]) /* Argument objects. */
850 {
851 Tk_Window tkwin = clientData;
852 TkDisplay *dispPtr;
853 int skip;
854
855 if (Tcl_IsSafe(interp)) {
856 Tcl_SetResult(interp,
857 "useinputmethods not accessible in a safe interpreter",
858 TCL_STATIC);
859 return TCL_ERROR;
860 }
861
862 skip = TkGetDisplayOf(interp, objc-1, objv+1, &tkwin);
863 if (skip < 0) {
864 return TCL_ERROR;
865 }
866 dispPtr = ((TkWindow *) tkwin)->dispPtr;
867 if ((objc - skip) == 2) {
868 /*
869 * In the case where TK_USE_INPUT_METHODS is not defined, this
870 * will be ignored and we will always return 0. That will indicate
871 * to the user that input methods are just not available.
872 */
873
874 int boolVal;
875
876 if (Tcl_GetBooleanFromObj(interp, objv[1+skip],
877 &boolVal) != TCL_OK) {
878 return TCL_ERROR;
879 }
880 #ifdef TK_USE_INPUT_METHODS
881 if (boolVal) {
882 dispPtr->flags |= TK_DISPLAY_USE_IM;
718883 } else {
719 int i, value, x = 0, y = 0, height = -1;
720
721 for (i = 3; i < objc; i += 2) {
722 if ((Tcl_GetIndexFromObj(interp, objv[i], caretStrings,
723 "caret option", 0, &index) != TCL_OK) ||
724 Tcl_GetIntFromObj(interp,objv[i+1],&value) != TCL_OK) {
725 return TCL_ERROR;
726 }
727 if (index == TK_CARET_X) {
728 x = value;
729 } else if (index == TK_CARET_Y) {
730 y = value;
731 } else /* if (index == TK_CARET_HEIGHT) -- last case */ {
732 height = value;
733 }
734 }
735 if (height < 0) {
736 height = Tk_Height(window);
737 }
738 Tk_SetCaretPos(window, x, y, height);
739 }
740 break;
741 }
742 case TK_SCALING: {
743 Screen *screenPtr;
744 int skip, width, height;
745 double d;
746
884 dispPtr->flags &= ~TK_DISPLAY_USE_IM;
885 }
886 #endif /* TK_USE_INPUT_METHODS */
887 } else if ((objc - skip) != 1) {
888 Tcl_WrongNumArgs(interp, 1, objv,
889 "?-displayof window? ?boolean?");
890 return TCL_ERROR;
891 }
892 Tcl_SetObjResult(interp,
893 Tcl_NewBooleanObj(dispPtr->flags & TK_DISPLAY_USE_IM));
894 return TCL_OK;
895 }
896
897 int
898 WindowingsystemCmd(
899 ClientData clientData, /* Main window associated with interpreter. */
900 Tcl_Interp *interp, /* Current interpreter. */
901 int objc, /* Number of arguments. */
902 Tcl_Obj *const objv[]) /* Argument objects. */
903 {
904 const char *windowingsystem;
905
906 if (objc != 1) {
907 Tcl_WrongNumArgs(interp, 1, objv, NULL);
908 return TCL_ERROR;
909 }
910 #if defined(WIN32)
911 windowingsystem = "win32";
912 #elif defined(MAC_OSX_TK)
913 windowingsystem = "aqua";
914 #else
915 windowingsystem = "x11";
916 #endif
917 Tcl_SetObjResult(interp, Tcl_NewStringObj(windowingsystem, -1));
918 return TCL_OK;
919 }
920
921 int
922 InactiveCmd(
923 ClientData clientData, /* Main window associated with interpreter. */
924 Tcl_Interp *interp, /* Current interpreter. */
925 int objc, /* Number of arguments. */
926 Tcl_Obj *const objv[]) /* Argument objects. */
927 {
928 Tk_Window tkwin = clientData;
929 int skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
930
931 if (skip < 0) {
932 return TCL_ERROR;
933 }
934 if (objc - skip == 1) {
935 long inactive;
936
937 inactive = (Tcl_IsSafe(interp) ? -1 :
938 Tk_GetUserInactiveTime(Tk_Display(tkwin)));
939 Tcl_SetObjResult(interp, Tcl_NewLongObj(inactive));
940
941 } else if (objc - skip == 2) {
942 char *string;
943
944 string = Tcl_GetString(objv[objc-1]);
945 if (strcmp(string, "reset") != 0) {
946 Tcl_Obj *msg = Tcl_NewStringObj("bad option \"", -1);
947
948 Tcl_AppendStringsToObj(msg, string, "\": must be reset", NULL);
949 Tcl_SetObjResult(interp, msg);
950 return TCL_ERROR;
951 }
747952 if (Tcl_IsSafe(interp)) {
748953 Tcl_SetResult(interp,
749 "scaling not accessible in a safe interpreter",
750 TCL_STATIC);
751 return TCL_ERROR;
752 }
753
754 skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
755 if (skip < 0) {
756 return TCL_ERROR;
757 }
758 screenPtr = Tk_Screen(tkwin);
759 if (objc - skip == 2) {
760 d = 25.4 / 72;
761 d *= WidthOfScreen(screenPtr);
762 d /= WidthMMOfScreen(screenPtr);
763 Tcl_SetObjResult(interp, Tcl_NewDoubleObj(d));
764 } else if (objc - skip == 3) {
765 if (Tcl_GetDoubleFromObj(interp, objv[2+skip], &d) != TCL_OK) {
766 return TCL_ERROR;
767 }
768 d = (25.4 / 72) / d;
769 width = (int) (d * WidthOfScreen(screenPtr) + 0.5);
770 if (width <= 0) {
771 width = 1;
772 }
773 height = (int) (d * HeightOfScreen(screenPtr) + 0.5);
774 if (height <= 0) {
775 height = 1;
776 }
777 WidthMMOfScreen(screenPtr) = width;
778 HeightMMOfScreen(screenPtr) = height;
779 } else {
780 Tcl_WrongNumArgs(interp, 2, objv,
781 "?-displayof window? ?factor?");
782 return TCL_ERROR;
783 }
784 break;
785 }
786 case TK_USE_IM: {
787 TkDisplay *dispPtr;
788 int skip;
789
790 if (Tcl_IsSafe(interp)) {
791 Tcl_SetResult(interp,
792 "useinputmethods not accessible in a safe interpreter",
793 TCL_STATIC);
794 return TCL_ERROR;
795 }
796
797 skip = TkGetDisplayOf(interp, objc-2, objv+2, &tkwin);
798 if (skip < 0) {
799 return TCL_ERROR;
800 }
801 dispPtr = ((TkWindow *) tkwin)->dispPtr;
802 if ((objc - skip) == 3) {
803 /*
804 * In the case where TK_USE_INPUT_METHODS is not defined, this
805 * will be ignored and we will always return 0. That will indicate
806 * to the user that input methods are just not available.
807 */
808
809 int boolVal;
810
811 if (Tcl_GetBooleanFromObj(interp, objv[2+skip],
812 &boolVal) != TCL_OK) {
813 return TCL_ERROR;
814 }
815 #ifdef TK_USE_INPUT_METHODS
816 if (boolVal) {
817 dispPtr->flags |= TK_DISPLAY_USE_IM;
818 } else {
819 dispPtr->flags &= ~TK_DISPLAY_USE_IM;
820 }
821 #endif /* TK_USE_INPUT_METHODS */
822 } else if ((objc - skip) != 2) {
823 Tcl_WrongNumArgs(interp, 2, objv,
824 "?-displayof window? ?boolean?");
825 return TCL_ERROR;
826 }
827 Tcl_SetObjResult(interp,
828 Tcl_NewBooleanObj(dispPtr->flags & TK_DISPLAY_USE_IM));
829 break;
830 }
831 case TK_WINDOWINGSYSTEM: {
832 const char *windowingsystem;
833
834 if (objc != 2) {
835 Tcl_WrongNumArgs(interp, 2, objv, NULL);
836 return TCL_ERROR;
837 }
838 #if defined(WIN32)
839 windowingsystem = "win32";
840 #elif defined(MAC_OSX_TK)
841 windowingsystem = "aqua";
842 #else
843 windowingsystem = "x11";
844 #endif
845 Tcl_SetObjResult(interp, Tcl_NewStringObj(windowingsystem, -1));
846 break;
847 }
848 case TK_INACTIVE: {
849 int skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
850
851 if (skip < 0) {
852 return TCL_ERROR;
853 }
854 if (objc - skip == 2) {
855 long inactive;
856
857 inactive = (Tcl_IsSafe(interp) ? -1 :
858 Tk_GetUserInactiveTime(Tk_Display(tkwin)));
859 Tcl_SetObjResult(interp, Tcl_NewLongObj(inactive));
860
861 } else if (objc - skip == 3) {
862 char *string;
863
864 string = Tcl_GetString(objv[objc-1]);
865 if (strcmp(string, "reset") != 0) {
866 Tcl_Obj *msg = Tcl_NewStringObj("bad option \"", -1);
867
868 Tcl_AppendStringsToObj(msg, string, "\": must be reset", NULL);
869 Tcl_SetObjResult(interp, msg);
870 return TCL_ERROR;
871 }
872 if (Tcl_IsSafe(interp)) {
873 Tcl_SetResult(interp,
874 "resetting the user inactivity timer "
875 "is not allowed in a safe interpreter", TCL_STATIC);
876 return TCL_ERROR;
877 }
878 Tk_ResetUserInactiveTime(Tk_Display(tkwin));
879 Tcl_ResetResult(interp);
880 } else {
881 Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? ?reset?");
882 return TCL_ERROR;
883 }
884 break;
885 }
954 "resetting the user inactivity timer "
955 "is not allowed in a safe interpreter", TCL_STATIC);
956 return TCL_ERROR;
957 }
958 Tk_ResetUserInactiveTime(Tk_Display(tkwin));
959 Tcl_ResetResult(interp);
960 } else {
961 Tcl_WrongNumArgs(interp, 1, objv, "?-displayof window? ?reset?");
962 return TCL_ERROR;
886963 }
887964 return TCL_OK;
888965 }
915992 Tk_Window tkwin = (Tk_Window) clientData;
916993 int done, index;
917994 int code = TCL_OK;
918 static const char *optionStrings[] = {
995 static const char *const optionStrings[] = {
919996 "variable", "visibility", "window", NULL
920997 };
921998 enum options {
11001177 int objc, /* Number of arguments. */
11011178 Tcl_Obj *const objv[]) /* Argument objects. */
11021179 {
1103 static const char *updateOptions[] = {"idletasks", NULL};
1180 static const char *const updateOptions[] = {"idletasks", NULL};
11041181 int flags, index;
11051182 TkDisplay *dispPtr;
11061183 int code = TCL_OK;
11991276 Tcl_Obj *const objv[]) /* Argument objects. */
12001277 {
12011278 int index, x, y, width, height, useX, useY, class, skip;
1202 char *string;
1279 const char *string;
12031280 TkWindow *winPtr;
12041281 Tk_Window tkwin;
12051282
12121289 {StaticGray, "staticgray"},
12131290 {-1, NULL}
12141291 };
1215 static const char *optionStrings[] = {
1292 static const char *const optionStrings[] = {
12161293 "cells", "children", "class", "colormapfull",
12171294 "depth", "geometry", "height", "id",
12181295 "ismapped", "manager", "name", "parent",
17511828 Tk_Window tkwin;
17521829 TkWindow *winPtr;
17531830
1754 static const char *optionStrings[] = {
1831 static const char *const optionStrings[] = {
17551832 "aspect", "client", "command", "deiconify",
17561833 "focusmodel", "frame", "geometry", "grid",
17571834 "group", "iconbitmap", "iconify", "iconmask",
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkColor.c,v 1.17 2008/04/27 22:38:55 dkf Exp $
13 * RCS: @(#) $Id: tkColor.c,v 1.19 2008/11/08 18:44:39 dkf Exp $
1414 */
1515
1616 #include "tkInt.h"
5252 * of the Tcl_Obj points to a TkColor object.
5353 */
5454
55 Tcl_ObjType tkColorObjType = {
55 const Tcl_ObjType tkColorObjType = {
5656 "color", /* name */
5757 FreeColorObjProc, /* freeIntRepProc */
5858 DupColorObjProc, /* dupIntRepProc */
713713 Tcl_GetString(objPtr);
714714 typePtr = objPtr->typePtr;
715715 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
716 (*typePtr->freeIntRepProc)(objPtr);
716 typePtr->freeIntRepProc(objPtr);
717717 }
718718 objPtr->typePtr = &tkColorObjType;
719719 objPtr->internalRep.twoPtrValue.ptr1 = NULL;
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkConfig.c,v 1.28 2008/10/05 18:22:21 dkf Exp $
11 * RCS: @(#) $Id: tkConfig.c,v 1.29 2008/10/15 06:41:06 nijtmans Exp $
1212 */
1313
1414 /*
135135 * the internalPtr2 field points to the entry that matched.
136136 */
137137
138 Tcl_ObjType tkOptionObjType = {
138 const Tcl_ObjType tkOptionObjType = {
139139 "option", /* name */
140140 NULL, /* freeIntRepProc */
141141 NULL, /* dupIntRepProc */
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkConsole.c,v 1.37 2008/04/27 22:38:56 dkf Exp $
12 * RCS: @(#) $Id: tkConsole.c,v 1.38 2008/10/17 23:18:37 nijtmans Exp $
1313 */
1414
1515 #include "tk.h"
113113 DWORD consoleParams;
114114 DWORD fileType;
115115 int mode;
116 char *bufMode;
116 const char *bufMode;
117117 HANDLE handle;
118118
119119 switch (type) {
672672 Tcl_Obj *const objv[]) /* Argument objects */
673673 {
674674 int index, result;
675 static const char *options[] = {"eval", "hide", "show", "title", NULL};
675 static const char *const options[] = {"eval", "hide", "show", "title", NULL};
676676 enum option {CON_EVAL, CON_HIDE, CON_SHOW, CON_TITLE};
677677 Tcl_Obj *cmd = NULL;
678678 ConsoleInfo *info = (ConsoleInfo *) clientData;
759759 Tcl_Obj *const objv[]) /* Argument objects */
760760 {
761761 int index, result = TCL_OK;
762 static const char *options[] = {"eval", "record", NULL};
762 static const char *const options[] = {"eval", "record", NULL};
763763 enum option {OTHER_EVAL, OTHER_RECORD};
764764 ConsoleInfo *info = clientData;
765765 Tcl_Interp *otherInterp = info->interp;
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkCursor.c,v 1.19 2008/04/27 22:38:56 dkf Exp $
13 * RCS: @(#) $Id: tkCursor.c,v 1.21 2008/11/08 18:44:39 dkf Exp $
1414 */
1515
1616 #include "tkInt.h"
5555 * option is set.
5656 */
5757
58 Tcl_ObjType tkCursorObjType = {
58 Tcl_ObjType const tkCursorObjType = {
5959 "cursor", /* name */
6060 FreeCursorObjProc, /* freeIntRepProc */
6161 DupCursorObjProc, /* dupIntRepProc */
759759 Tcl_GetString(objPtr);
760760 typePtr = objPtr->typePtr;
761761 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
762 (*typePtr->freeIntRepProc)(objPtr);
762 typePtr->freeIntRepProc(objPtr);
763763 }
764764 objPtr->typePtr = &tkCursorObjType;
765765 objPtr->internalRep.twoPtrValue.ptr1 = NULL;
77 * See the file "license.terms" for information on usage and redistribution
88 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkDecls.h,v 1.34 2008/04/08 15:00:37 das Exp $
10 * RCS: @(#) $Id: tkDecls.h,v 1.40 2008/11/12 00:15:26 nijtmans Exp $
1111 */
1212
1313 #ifndef _TKDECLS
4343 #ifndef Tk_3DBorderGC_TCL_DECLARED
4444 #define Tk_3DBorderGC_TCL_DECLARED
4545 /* 2 */
46 EXTERN GC Tk_3DBorderGC (Tk_Window tkwin, Tk_3DBorder border,
46 EXTERN GC Tk_3DBorderGC (Tk_Window tkwin, Tk_3DBorder border,
4747 int which);
4848 #endif
4949 #ifndef Tk_3DHorizontalBevel_TCL_DECLARED
5050 #define Tk_3DHorizontalBevel_TCL_DECLARED
5151 /* 3 */
52 EXTERN void Tk_3DHorizontalBevel (Tk_Window tkwin,
53 Drawable drawable, Tk_3DBorder border, int x,
54 int y, int width, int height, int leftIn,
52 EXTERN void Tk_3DHorizontalBevel (Tk_Window tkwin,
53 Drawable drawable, Tk_3DBorder border, int x,
54 int y, int width, int height, int leftIn,
5555 int rightIn, int topBevel, int relief);
5656 #endif
5757 #ifndef Tk_3DVerticalBevel_TCL_DECLARED
5858 #define Tk_3DVerticalBevel_TCL_DECLARED
5959 /* 4 */
60 EXTERN void Tk_3DVerticalBevel (Tk_Window tkwin,
61 Drawable drawable, Tk_3DBorder border, int x,
62 int y, int width, int height, int leftBevel,
60 EXTERN void Tk_3DVerticalBevel (Tk_Window tkwin,
61 Drawable drawable, Tk_3DBorder border, int x,
62 int y, int width, int height, int leftBevel,
6363 int relief);
6464 #endif
6565 #ifndef Tk_AddOption_TCL_DECLARED
6666 #define Tk_AddOption_TCL_DECLARED
6767 /* 5 */
68 EXTERN void Tk_AddOption (Tk_Window tkwin, CONST char * name,
69 CONST char * value, int priority);
68 EXTERN void Tk_AddOption (Tk_Window tkwin, const char * name,
69 const char * value, int priority);
7070 #endif
7171 #ifndef Tk_BindEvent_TCL_DECLARED
7272 #define Tk_BindEvent_TCL_DECLARED
7373 /* 6 */
74 EXTERN void Tk_BindEvent (Tk_BindingTable bindingTable,
75 XEvent * eventPtr, Tk_Window tkwin,
74 EXTERN void Tk_BindEvent (Tk_BindingTable bindingTable,
75 XEvent * eventPtr, Tk_Window tkwin,
7676 int numObjects, ClientData * objectPtr);
7777 #endif
7878 #ifndef Tk_CanvasDrawableCoords_TCL_DECLARED
7979 #define Tk_CanvasDrawableCoords_TCL_DECLARED
8080 /* 7 */
81 EXTERN void Tk_CanvasDrawableCoords (Tk_Canvas canvas, double x,
82 double y, short * drawableXPtr,
81 EXTERN void Tk_CanvasDrawableCoords (Tk_Canvas canvas, double x,
82 double y, short * drawableXPtr,
8383 short * drawableYPtr);
8484 #endif
8585 #ifndef Tk_CanvasEventuallyRedraw_TCL_DECLARED
8686 #define Tk_CanvasEventuallyRedraw_TCL_DECLARED
8787 /* 8 */
88 EXTERN void Tk_CanvasEventuallyRedraw (Tk_Canvas canvas, int x1,
88 EXTERN void Tk_CanvasEventuallyRedraw (Tk_Canvas canvas, int x1,
8989 int y1, int x2, int y2);
9090 #endif
9191 #ifndef Tk_CanvasGetCoord_TCL_DECLARED
9292 #define Tk_CanvasGetCoord_TCL_DECLARED
9393 /* 9 */
94 EXTERN int Tk_CanvasGetCoord (Tcl_Interp * interp,
95 Tk_Canvas canvas, CONST char * str,
94 EXTERN int Tk_CanvasGetCoord (Tcl_Interp * interp,
95 Tk_Canvas canvas, const char * str,
9696 double * doublePtr);
9797 #endif
9898 #ifndef Tk_CanvasGetTextInfo_TCL_DECLARED
103103 #ifndef Tk_CanvasPsBitmap_TCL_DECLARED
104104 #define Tk_CanvasPsBitmap_TCL_DECLARED
105105 /* 11 */
106 EXTERN int Tk_CanvasPsBitmap (Tcl_Interp * interp,
107 Tk_Canvas canvas, Pixmap bitmap, int x,
106 EXTERN int Tk_CanvasPsBitmap (Tcl_Interp * interp,
107 Tk_Canvas canvas, Pixmap bitmap, int x,
108108 int y, int width, int height);
109109 #endif
110110 #ifndef Tk_CanvasPsColor_TCL_DECLARED
111111 #define Tk_CanvasPsColor_TCL_DECLARED
112112 /* 12 */
113 EXTERN int Tk_CanvasPsColor (Tcl_Interp * interp,
113 EXTERN int Tk_CanvasPsColor (Tcl_Interp * interp,
114114 Tk_Canvas canvas, XColor * colorPtr);
115115 #endif
116116 #ifndef Tk_CanvasPsFont_TCL_DECLARED
117117 #define Tk_CanvasPsFont_TCL_DECLARED
118118 /* 13 */
119 EXTERN int Tk_CanvasPsFont (Tcl_Interp * interp,
119 EXTERN int Tk_CanvasPsFont (Tcl_Interp * interp,
120120 Tk_Canvas canvas, Tk_Font font);
121121 #endif
122122 #ifndef Tk_CanvasPsPath_TCL_DECLARED
123123 #define Tk_CanvasPsPath_TCL_DECLARED
124124 /* 14 */
125 EXTERN void Tk_CanvasPsPath (Tcl_Interp * interp,
126 Tk_Canvas canvas, double * coordPtr,
125 EXTERN void Tk_CanvasPsPath (Tcl_Interp * interp,
126 Tk_Canvas canvas, double * coordPtr,
127127 int numPoints);
128128 #endif
129129 #ifndef Tk_CanvasPsStipple_TCL_DECLARED
130130 #define Tk_CanvasPsStipple_TCL_DECLARED
131131 /* 15 */
132 EXTERN int Tk_CanvasPsStipple (Tcl_Interp * interp,
132 EXTERN int Tk_CanvasPsStipple (Tcl_Interp * interp,
133133 Tk_Canvas canvas, Pixmap bitmap);
134134 #endif
135135 #ifndef Tk_CanvasPsY_TCL_DECLARED
145145 #ifndef Tk_CanvasTagsParseProc_TCL_DECLARED
146146 #define Tk_CanvasTagsParseProc_TCL_DECLARED
147147 /* 18 */
148 EXTERN int Tk_CanvasTagsParseProc (ClientData clientData,
149 Tcl_Interp * interp, Tk_Window tkwin,
150 CONST char * value, char * widgRec,
148 EXTERN int Tk_CanvasTagsParseProc (ClientData clientData,
149 Tcl_Interp * interp, Tk_Window tkwin,
150 const char * value, char * widgRec,
151151 int offset);
152152 #endif
153153 #ifndef Tk_CanvasTagsPrintProc_TCL_DECLARED
154154 #define Tk_CanvasTagsPrintProc_TCL_DECLARED
155155 /* 19 */
156 EXTERN char * Tk_CanvasTagsPrintProc (ClientData clientData,
157 Tk_Window tkwin, char * widgRec, int offset,
156 EXTERN CONST86 char * Tk_CanvasTagsPrintProc (ClientData clientData,
157 Tk_Window tkwin, char * widgRec, int offset,
158158 Tcl_FreeProc ** freeProcPtr);
159159 #endif
160160 #ifndef Tk_CanvasTkwin_TCL_DECLARED
165165 #ifndef Tk_CanvasWindowCoords_TCL_DECLARED
166166 #define Tk_CanvasWindowCoords_TCL_DECLARED
167167 /* 21 */
168 EXTERN void Tk_CanvasWindowCoords (Tk_Canvas canvas, double x,
169 double y, short * screenXPtr,
168 EXTERN void Tk_CanvasWindowCoords (Tk_Canvas canvas, double x,
169 double y, short * screenXPtr,
170170 short * screenYPtr);
171171 #endif
172172 #ifndef Tk_ChangeWindowAttributes_TCL_DECLARED
173173 #define Tk_ChangeWindowAttributes_TCL_DECLARED
174174 /* 22 */
175 EXTERN void Tk_ChangeWindowAttributes (Tk_Window tkwin,
176 unsigned long valueMask,
175 EXTERN void Tk_ChangeWindowAttributes (Tk_Window tkwin,
176 unsigned long valueMask,
177177 XSetWindowAttributes * attsPtr);
178178 #endif
179179 #ifndef Tk_CharBbox_TCL_DECLARED
180180 #define Tk_CharBbox_TCL_DECLARED
181181 /* 23 */
182 EXTERN int Tk_CharBbox (Tk_TextLayout layout, int index,
183 int * xPtr, int * yPtr, int * widthPtr,
182 EXTERN int Tk_CharBbox (Tk_TextLayout layout, int index,
183 int * xPtr, int * yPtr, int * widthPtr,
184184 int * heightPtr);
185185 #endif
186186 #ifndef Tk_ClearSelection_TCL_DECLARED
191191 #ifndef Tk_ClipboardAppend_TCL_DECLARED
192192 #define Tk_ClipboardAppend_TCL_DECLARED
193193 /* 25 */
194 EXTERN int Tk_ClipboardAppend (Tcl_Interp * interp,
195 Tk_Window tkwin, Atom target, Atom format,
194 EXTERN int Tk_ClipboardAppend (Tcl_Interp * interp,
195 Tk_Window tkwin, Atom target, Atom format,
196196 char* buffer);
197197 #endif
198198 #ifndef Tk_ClipboardClear_TCL_DECLARED
199199 #define Tk_ClipboardClear_TCL_DECLARED
200200 /* 26 */
201 EXTERN int Tk_ClipboardClear (Tcl_Interp * interp,
201 EXTERN int Tk_ClipboardClear (Tcl_Interp * interp,
202202 Tk_Window tkwin);
203203 #endif
204204 #ifndef Tk_ConfigureInfo_TCL_DECLARED
205205 #define Tk_ConfigureInfo_TCL_DECLARED
206206 /* 27 */
207 EXTERN int Tk_ConfigureInfo (Tcl_Interp * interp,
208 Tk_Window tkwin, Tk_ConfigSpec * specs,
209 char * widgRec, CONST char * argvName,
207 EXTERN int Tk_ConfigureInfo (Tcl_Interp * interp,
208 Tk_Window tkwin, Tk_ConfigSpec * specs,
209 char * widgRec, const char * argvName,
210210 int flags);
211211 #endif
212212 #ifndef Tk_ConfigureValue_TCL_DECLARED
213213 #define Tk_ConfigureValue_TCL_DECLARED
214214 /* 28 */
215 EXTERN int Tk_ConfigureValue (Tcl_Interp * interp,
216 Tk_Window tkwin, Tk_ConfigSpec * specs,
217 char * widgRec, CONST char * argvName,
215 EXTERN int Tk_ConfigureValue (Tcl_Interp * interp,
216 Tk_Window tkwin, Tk_ConfigSpec * specs,
217 char * widgRec, const char * argvName,
218218 int flags);
219219 #endif
220220 #ifndef Tk_ConfigureWidget_TCL_DECLARED
221221 #define Tk_ConfigureWidget_TCL_DECLARED
222222 /* 29 */
223 EXTERN int Tk_ConfigureWidget (Tcl_Interp * interp,
224 Tk_Window tkwin, Tk_ConfigSpec * specs,
225 int argc, CONST84 char ** argv,
223 EXTERN int Tk_ConfigureWidget (Tcl_Interp * interp,
224 Tk_Window tkwin, Tk_ConfigSpec * specs,
225 int argc, CONST84 char ** argv,
226226 char * widgRec, int flags);
227227 #endif
228228 #ifndef Tk_ConfigureWindow_TCL_DECLARED
229229 #define Tk_ConfigureWindow_TCL_DECLARED
230230 /* 30 */
231 EXTERN void Tk_ConfigureWindow (Tk_Window tkwin,
232 unsigned int valueMask,
231 EXTERN void Tk_ConfigureWindow (Tk_Window tkwin,
232 unsigned int valueMask,
233233 XWindowChanges * valuePtr);
234234 #endif
235235 #ifndef Tk_ComputeTextLayout_TCL_DECLARED
236236 #define Tk_ComputeTextLayout_TCL_DECLARED
237237 /* 31 */
238 EXTERN Tk_TextLayout Tk_ComputeTextLayout (Tk_Font font, CONST char * str,
239 int numChars, int wrapLength,
240 Tk_Justify justify, int flags,
238 EXTERN Tk_TextLayout Tk_ComputeTextLayout (Tk_Font font, const char * str,
239 int numChars, int wrapLength,
240 Tk_Justify justify, int flags,
241241 int * widthPtr, int * heightPtr);
242242 #endif
243243 #ifndef Tk_CoordsToWindow_TCL_DECLARED
244244 #define Tk_CoordsToWindow_TCL_DECLARED
245245 /* 32 */
246 EXTERN Tk_Window Tk_CoordsToWindow (int rootX, int rootY,
246 EXTERN Tk_Window Tk_CoordsToWindow (int rootX, int rootY,
247247 Tk_Window tkwin);
248248 #endif
249249 #ifndef Tk_CreateBinding_TCL_DECLARED
250250 #define Tk_CreateBinding_TCL_DECLARED
251251 /* 33 */
252 EXTERN unsigned long Tk_CreateBinding (Tcl_Interp * interp,
253 Tk_BindingTable bindingTable,
254 ClientData object, CONST char * eventStr,
255 CONST char * command, int append);
252 EXTERN unsigned long Tk_CreateBinding (Tcl_Interp * interp,
253 Tk_BindingTable bindingTable,
254 ClientData object, const char * eventStr,
255 const char * command, int append);
256256 #endif
257257 #ifndef Tk_CreateBindingTable_TCL_DECLARED
258258 #define Tk_CreateBindingTable_TCL_DECLARED
262262 #ifndef Tk_CreateErrorHandler_TCL_DECLARED
263263 #define Tk_CreateErrorHandler_TCL_DECLARED
264264 /* 35 */
265 EXTERN Tk_ErrorHandler Tk_CreateErrorHandler (Display * display, int errNum,
266 int request, int minorCode,
267 Tk_ErrorProc * errorProc,
265 EXTERN Tk_ErrorHandler Tk_CreateErrorHandler (Display * display, int errNum,
266 int request, int minorCode,
267 Tk_ErrorProc * errorProc,
268268 ClientData clientData);
269269 #endif
270270 #ifndef Tk_CreateEventHandler_TCL_DECLARED
271271 #define Tk_CreateEventHandler_TCL_DECLARED
272272 /* 36 */
273 EXTERN void Tk_CreateEventHandler (Tk_Window token,
274 unsigned long mask, Tk_EventProc * proc,
273 EXTERN void Tk_CreateEventHandler (Tk_Window token,
274 unsigned long mask, Tk_EventProc * proc,
275275 ClientData clientData);
276276 #endif
277277 #ifndef Tk_CreateGenericHandler_TCL_DECLARED
278278 #define Tk_CreateGenericHandler_TCL_DECLARED
279279 /* 37 */
280 EXTERN void Tk_CreateGenericHandler (Tk_GenericProc * proc,
280 EXTERN void Tk_CreateGenericHandler (Tk_GenericProc * proc,
281281 ClientData clientData);
282282 #endif
283283 #ifndef Tk_CreateImageType_TCL_DECLARED
284284 #define Tk_CreateImageType_TCL_DECLARED
285285 /* 38 */
286 EXTERN void Tk_CreateImageType (Tk_ImageType * typePtr);
286 EXTERN void Tk_CreateImageType (const Tk_ImageType * typePtr);
287287 #endif
288288 #ifndef Tk_CreateItemType_TCL_DECLARED
289289 #define Tk_CreateItemType_TCL_DECLARED
294294 #define Tk_CreatePhotoImageFormat_TCL_DECLARED
295295 /* 40 */
296296 EXTERN void Tk_CreatePhotoImageFormat (
297 Tk_PhotoImageFormat * formatPtr);
297 const Tk_PhotoImageFormat * formatPtr);
298298 #endif
299299 #ifndef Tk_CreateSelHandler_TCL_DECLARED
300300 #define Tk_CreateSelHandler_TCL_DECLARED
301301 /* 41 */
302 EXTERN void Tk_CreateSelHandler (Tk_Window tkwin, Atom selection,
303 Atom target, Tk_SelectionProc * proc,
302 EXTERN void Tk_CreateSelHandler (Tk_Window tkwin, Atom selection,
303 Atom target, Tk_SelectionProc * proc,
304304 ClientData clientData, Atom format);
305305 #endif
306306 #ifndef Tk_CreateWindow_TCL_DECLARED
307307 #define Tk_CreateWindow_TCL_DECLARED
308308 /* 42 */
309 EXTERN Tk_Window Tk_CreateWindow (Tcl_Interp * interp,
310 Tk_Window parent, CONST char * name,
311 CONST char * screenName);
309 EXTERN Tk_Window Tk_CreateWindow (Tcl_Interp * interp,
310 Tk_Window parent, const char * name,
311 const char * screenName);
312312 #endif
313313 #ifndef Tk_CreateWindowFromPath_TCL_DECLARED
314314 #define Tk_CreateWindowFromPath_TCL_DECLARED
315315 /* 43 */
316 EXTERN Tk_Window Tk_CreateWindowFromPath (Tcl_Interp * interp,
317 Tk_Window tkwin, CONST char * pathName,
318 CONST char * screenName);
316 EXTERN Tk_Window Tk_CreateWindowFromPath (Tcl_Interp * interp,
317 Tk_Window tkwin, const char * pathName,
318 const char * screenName);
319319 #endif
320320 #ifndef Tk_DefineBitmap_TCL_DECLARED
321321 #define Tk_DefineBitmap_TCL_DECLARED
322322 /* 44 */
323 EXTERN int Tk_DefineBitmap (Tcl_Interp * interp,
324 CONST char * name, CONST char * source,
323 EXTERN int Tk_DefineBitmap (Tcl_Interp * interp,
324 const char * name, const char * source,
325325 int width, int height);
326326 #endif
327327 #ifndef Tk_DefineCursor_TCL_DECLARED
332332 #ifndef Tk_DeleteAllBindings_TCL_DECLARED
333333 #define Tk_DeleteAllBindings_TCL_DECLARED
334334 /* 46 */
335 EXTERN void Tk_DeleteAllBindings (Tk_BindingTable bindingTable,
335 EXTERN void Tk_DeleteAllBindings (Tk_BindingTable bindingTable,
336336 ClientData object);
337337 #endif
338338 #ifndef Tk_DeleteBinding_TCL_DECLARED
339339 #define Tk_DeleteBinding_TCL_DECLARED
340340 /* 47 */
341 EXTERN int Tk_DeleteBinding (Tcl_Interp * interp,
342 Tk_BindingTable bindingTable,
343 ClientData object, CONST char * eventStr);
341 EXTERN int Tk_DeleteBinding (Tcl_Interp * interp,
342 Tk_BindingTable bindingTable,
343 ClientData object, const char * eventStr);
344344 #endif
345345 #ifndef Tk_DeleteBindingTable_TCL_DECLARED
346346 #define Tk_DeleteBindingTable_TCL_DECLARED
355355 #ifndef Tk_DeleteEventHandler_TCL_DECLARED
356356 #define Tk_DeleteEventHandler_TCL_DECLARED
357357 /* 50 */
358 EXTERN void Tk_DeleteEventHandler (Tk_Window token,
359 unsigned long mask, Tk_EventProc * proc,
358 EXTERN void Tk_DeleteEventHandler (Tk_Window token,
359 unsigned long mask, Tk_EventProc * proc,
360360 ClientData clientData);
361361 #endif
362362 #ifndef Tk_DeleteGenericHandler_TCL_DECLARED
363363 #define Tk_DeleteGenericHandler_TCL_DECLARED
364364 /* 51 */
365 EXTERN void Tk_DeleteGenericHandler (Tk_GenericProc * proc,
365 EXTERN void Tk_DeleteGenericHandler (Tk_GenericProc * proc,
366366 ClientData clientData);
367367 #endif
368368 #ifndef Tk_DeleteImage_TCL_DECLARED
369369 #define Tk_DeleteImage_TCL_DECLARED
370370 /* 52 */
371 EXTERN void Tk_DeleteImage (Tcl_Interp * interp,
372 CONST char * name);
371 EXTERN void Tk_DeleteImage (Tcl_Interp * interp,
372 const char * name);
373373 #endif
374374 #ifndef Tk_DeleteSelHandler_TCL_DECLARED
375375 #define Tk_DeleteSelHandler_TCL_DECLARED
376376 /* 53 */
377 EXTERN void Tk_DeleteSelHandler (Tk_Window tkwin, Atom selection,
377 EXTERN void Tk_DeleteSelHandler (Tk_Window tkwin, Atom selection,
378378 Atom target);
379379 #endif
380380 #ifndef Tk_DestroyWindow_TCL_DECLARED
390390 #ifndef Tk_DistanceToTextLayout_TCL_DECLARED
391391 #define Tk_DistanceToTextLayout_TCL_DECLARED
392392 /* 56 */
393 EXTERN int Tk_DistanceToTextLayout (Tk_TextLayout layout, int x,
393 EXTERN int Tk_DistanceToTextLayout (Tk_TextLayout layout, int x,
394394 int y);
395395 #endif
396396 #ifndef Tk_Draw3DPolygon_TCL_DECLARED
397397 #define Tk_Draw3DPolygon_TCL_DECLARED
398398 /* 57 */
399 EXTERN void Tk_Draw3DPolygon (Tk_Window tkwin, Drawable drawable,
400 Tk_3DBorder border, XPoint * pointPtr,
401 int numPoints, int borderWidth,
399 EXTERN void Tk_Draw3DPolygon (Tk_Window tkwin, Drawable drawable,
400 Tk_3DBorder border, XPoint * pointPtr,
401 int numPoints, int borderWidth,
402402 int leftRelief);
403403 #endif
404404 #ifndef Tk_Draw3DRectangle_TCL_DECLARED
405405 #define Tk_Draw3DRectangle_TCL_DECLARED
406406 /* 58 */
407 EXTERN void Tk_Draw3DRectangle (Tk_Window tkwin,
408 Drawable drawable, Tk_3DBorder border, int x,
409 int y, int width, int height,
407 EXTERN void Tk_Draw3DRectangle (Tk_Window tkwin,
408 Drawable drawable, Tk_3DBorder border, int x,
409 int y, int width, int height,
410410 int borderWidth, int relief);
411411 #endif
412412 #ifndef Tk_DrawChars_TCL_DECLARED
413413 #define Tk_DrawChars_TCL_DECLARED
414414 /* 59 */
415 EXTERN void Tk_DrawChars (Display * display, Drawable drawable,
416 GC gc, Tk_Font tkfont, CONST char * source,
415 EXTERN void Tk_DrawChars (Display * display, Drawable drawable,
416 GC gc, Tk_Font tkfont, const char * source,
417417 int numBytes, int x, int y);
418418 #endif
419419 #ifndef Tk_DrawFocusHighlight_TCL_DECLARED
420420 #define Tk_DrawFocusHighlight_TCL_DECLARED
421421 /* 60 */
422 EXTERN void Tk_DrawFocusHighlight (Tk_Window tkwin, GC gc,
422 EXTERN void Tk_DrawFocusHighlight (Tk_Window tkwin, GC gc,
423423 int width, Drawable drawable);
424424 #endif
425425 #ifndef Tk_DrawTextLayout_TCL_DECLARED
426426 #define Tk_DrawTextLayout_TCL_DECLARED
427427 /* 61 */
428 EXTERN void Tk_DrawTextLayout (Display * display,
429 Drawable drawable, GC gc,
430 Tk_TextLayout layout, int x, int y,
428 EXTERN void Tk_DrawTextLayout (Display * display,
429 Drawable drawable, GC gc,
430 Tk_TextLayout layout, int x, int y,
431431 int firstChar, int lastChar);
432432 #endif
433433 #ifndef Tk_Fill3DPolygon_TCL_DECLARED
434434 #define Tk_Fill3DPolygon_TCL_DECLARED
435435 /* 62 */
436 EXTERN void Tk_Fill3DPolygon (Tk_Window tkwin, Drawable drawable,
437 Tk_3DBorder border, XPoint * pointPtr,
438 int numPoints, int borderWidth,
436 EXTERN void Tk_Fill3DPolygon (Tk_Window tkwin, Drawable drawable,
437 Tk_3DBorder border, XPoint * pointPtr,
438 int numPoints, int borderWidth,
439439 int leftRelief);
440440 #endif
441441 #ifndef Tk_Fill3DRectangle_TCL_DECLARED
442442 #define Tk_Fill3DRectangle_TCL_DECLARED
443443 /* 63 */
444 EXTERN void Tk_Fill3DRectangle (Tk_Window tkwin,
445 Drawable drawable, Tk_3DBorder border, int x,
446 int y, int width, int height,
444 EXTERN void Tk_Fill3DRectangle (Tk_Window tkwin,
445 Drawable drawable, Tk_3DBorder border, int x,
446 int y, int width, int height,
447447 int borderWidth, int relief);
448448 #endif
449449 #ifndef Tk_FindPhoto_TCL_DECLARED
450450 #define Tk_FindPhoto_TCL_DECLARED
451451 /* 64 */
452 EXTERN Tk_PhotoHandle Tk_FindPhoto (Tcl_Interp * interp,
453 CONST char * imageName);
452 EXTERN Tk_PhotoHandle Tk_FindPhoto (Tcl_Interp * interp,
453 const char * imageName);
454454 #endif
455455 #ifndef Tk_FontId_TCL_DECLARED
456456 #define Tk_FontId_TCL_DECLARED
475475 #ifndef Tk_FreeColormap_TCL_DECLARED
476476 #define Tk_FreeColormap_TCL_DECLARED
477477 /* 69 */
478 EXTERN void Tk_FreeColormap (Display * display,
478 EXTERN void Tk_FreeColormap (Display * display,
479479 Colormap colormap);
480480 #endif
481481 #ifndef Tk_FreeCursor_TCL_DECLARED
501501 #ifndef Tk_FreeOptions_TCL_DECLARED
502502 #define Tk_FreeOptions_TCL_DECLARED
503503 /* 74 */
504 EXTERN void Tk_FreeOptions (Tk_ConfigSpec * specs,
505 char * widgRec, Display * display,
504 EXTERN void Tk_FreeOptions (Tk_ConfigSpec * specs,
505 char * widgRec, Display * display,
506506 int needFlags);
507507 #endif
508508 #ifndef Tk_FreePixmap_TCL_DECLARED
528528 #ifndef Tk_GeometryRequest_TCL_DECLARED
529529 #define Tk_GeometryRequest_TCL_DECLARED
530530 /* 79 */
531 EXTERN void Tk_GeometryRequest (Tk_Window tkwin, int reqWidth,
531 EXTERN void Tk_GeometryRequest (Tk_Window tkwin, int reqWidth,
532532 int reqHeight);
533533 #endif
534534 #ifndef Tk_Get3DBorder_TCL_DECLARED
535535 #define Tk_Get3DBorder_TCL_DECLARED
536536 /* 80 */
537 EXTERN Tk_3DBorder Tk_Get3DBorder (Tcl_Interp * interp, Tk_Window tkwin,
537 EXTERN Tk_3DBorder Tk_Get3DBorder (Tcl_Interp * interp, Tk_Window tkwin,
538538 Tk_Uid colorName);
539539 #endif
540540 #ifndef Tk_GetAllBindings_TCL_DECLARED
541541 #define Tk_GetAllBindings_TCL_DECLARED
542542 /* 81 */
543 EXTERN void Tk_GetAllBindings (Tcl_Interp * interp,
544 Tk_BindingTable bindingTable,
543 EXTERN void Tk_GetAllBindings (Tcl_Interp * interp,
544 Tk_BindingTable bindingTable,
545545 ClientData object);
546546 #endif
547547 #ifndef Tk_GetAnchor_TCL_DECLARED
548548 #define Tk_GetAnchor_TCL_DECLARED
549549 /* 82 */
550 EXTERN int Tk_GetAnchor (Tcl_Interp * interp, CONST char * str,
550 EXTERN int Tk_GetAnchor (Tcl_Interp * interp, const char * str,
551551 Tk_Anchor * anchorPtr);
552552 #endif
553553 #ifndef Tk_GetAtomName_TCL_DECLARED
558558 #ifndef Tk_GetBinding_TCL_DECLARED
559559 #define Tk_GetBinding_TCL_DECLARED
560560 /* 84 */
561 EXTERN CONST84_RETURN char * Tk_GetBinding (Tcl_Interp * interp,
562 Tk_BindingTable bindingTable,
563 ClientData object, CONST char * eventStr);
561 EXTERN CONST84_RETURN char * Tk_GetBinding (Tcl_Interp * interp,
562 Tk_BindingTable bindingTable,
563 ClientData object, const char * eventStr);
564564 #endif
565565 #ifndef Tk_GetBitmap_TCL_DECLARED
566566 #define Tk_GetBitmap_TCL_DECLARED
567567 /* 85 */
568 EXTERN Pixmap Tk_GetBitmap (Tcl_Interp * interp, Tk_Window tkwin,
569 CONST char * str);
568 EXTERN Pixmap Tk_GetBitmap (Tcl_Interp * interp, Tk_Window tkwin,
569 const char * str);
570570 #endif
571571 #ifndef Tk_GetBitmapFromData_TCL_DECLARED
572572 #define Tk_GetBitmapFromData_TCL_DECLARED
573573 /* 86 */
574 EXTERN Pixmap Tk_GetBitmapFromData (Tcl_Interp * interp,
575 Tk_Window tkwin, CONST char * source,
574 EXTERN Pixmap Tk_GetBitmapFromData (Tcl_Interp * interp,
575 Tk_Window tkwin, const char * source,
576576 int width, int height);
577577 #endif
578578 #ifndef Tk_GetCapStyle_TCL_DECLARED
579579 #define Tk_GetCapStyle_TCL_DECLARED
580580 /* 87 */
581 EXTERN int Tk_GetCapStyle (Tcl_Interp * interp,
582 CONST char * str, int * capPtr);
581 EXTERN int Tk_GetCapStyle (Tcl_Interp * interp,
582 const char * str, int * capPtr);
583583 #endif
584584 #ifndef Tk_GetColor_TCL_DECLARED
585585 #define Tk_GetColor_TCL_DECLARED
586586 /* 88 */
587 EXTERN XColor * Tk_GetColor (Tcl_Interp * interp, Tk_Window tkwin,
587 EXTERN XColor * Tk_GetColor (Tcl_Interp * interp, Tk_Window tkwin,
588588 Tk_Uid name);
589589 #endif
590590 #ifndef Tk_GetColorByValue_TCL_DECLARED
591591 #define Tk_GetColorByValue_TCL_DECLARED
592592 /* 89 */
593 EXTERN XColor * Tk_GetColorByValue (Tk_Window tkwin,
593 EXTERN XColor * Tk_GetColorByValue (Tk_Window tkwin,
594594 XColor * colorPtr);
595595 #endif
596596 #ifndef Tk_GetColormap_TCL_DECLARED
597597 #define Tk_GetColormap_TCL_DECLARED
598598 /* 90 */
599 EXTERN Colormap Tk_GetColormap (Tcl_Interp * interp, Tk_Window tkwin,
600 CONST char * str);
599 EXTERN Colormap Tk_GetColormap (Tcl_Interp * interp, Tk_Window tkwin,
600 const char * str);
601601 #endif
602602 #ifndef Tk_GetCursor_TCL_DECLARED
603603 #define Tk_GetCursor_TCL_DECLARED
604604 /* 91 */
605 EXTERN Tk_Cursor Tk_GetCursor (Tcl_Interp * interp, Tk_Window tkwin,
605 EXTERN Tk_Cursor Tk_GetCursor (Tcl_Interp * interp, Tk_Window tkwin,
606606 Tk_Uid str);
607607 #endif
608608 #ifndef Tk_GetCursorFromData_TCL_DECLARED
609609 #define Tk_GetCursorFromData_TCL_DECLARED
610610 /* 92 */
611 EXTERN Tk_Cursor Tk_GetCursorFromData (Tcl_Interp * interp,
612 Tk_Window tkwin, CONST char * source,
613 CONST char * mask, int width, int height,
611 EXTERN Tk_Cursor Tk_GetCursorFromData (Tcl_Interp * interp,
612 Tk_Window tkwin, const char * source,
613 const char * mask, int width, int height,
614614 int xHot, int yHot, Tk_Uid fg, Tk_Uid bg);
615615 #endif
616616 #ifndef Tk_GetFont_TCL_DECLARED
617617 #define Tk_GetFont_TCL_DECLARED
618618 /* 93 */
619 EXTERN Tk_Font Tk_GetFont (Tcl_Interp * interp, Tk_Window tkwin,
620 CONST char * str);
619 EXTERN Tk_Font Tk_GetFont (Tcl_Interp * interp, Tk_Window tkwin,
620 const char * str);
621621 #endif
622622 #ifndef Tk_GetFontFromObj_TCL_DECLARED
623623 #define Tk_GetFontFromObj_TCL_DECLARED
627627 #ifndef Tk_GetFontMetrics_TCL_DECLARED
628628 #define Tk_GetFontMetrics_TCL_DECLARED
629629 /* 95 */
630 EXTERN void Tk_GetFontMetrics (Tk_Font font,
630 EXTERN void Tk_GetFontMetrics (Tk_Font font,
631631 Tk_FontMetrics * fmPtr);
632632 #endif
633633 #ifndef Tk_GetGC_TCL_DECLARED
634634 #define Tk_GetGC_TCL_DECLARED
635635 /* 96 */
636 EXTERN GC Tk_GetGC (Tk_Window tkwin, unsigned long valueMask,
636 EXTERN GC Tk_GetGC (Tk_Window tkwin, unsigned long valueMask,
637637 XGCValues * valuePtr);
638638 #endif
639639 #ifndef Tk_GetImage_TCL_DECLARED
640640 #define Tk_GetImage_TCL_DECLARED
641641 /* 97 */
642 EXTERN Tk_Image Tk_GetImage (Tcl_Interp * interp, Tk_Window tkwin,
643 CONST char * name,
644 Tk_ImageChangedProc * changeProc,
642 EXTERN Tk_Image Tk_GetImage (Tcl_Interp * interp, Tk_Window tkwin,
643 const char * name,
644 Tk_ImageChangedProc * changeProc,
645645 ClientData clientData);
646646 #endif
647647 #ifndef Tk_GetImageMasterData_TCL_DECLARED
648648 #define Tk_GetImageMasterData_TCL_DECLARED
649649 /* 98 */
650 EXTERN ClientData Tk_GetImageMasterData (Tcl_Interp * interp,
651 CONST char * name,
652 Tk_ImageType ** typePtrPtr);
650 EXTERN ClientData Tk_GetImageMasterData (Tcl_Interp * interp,
651 const char * name,
652 CONST86 Tk_ImageType ** typePtrPtr);
653653 #endif
654654 #ifndef Tk_GetItemTypes_TCL_DECLARED
655655 #define Tk_GetItemTypes_TCL_DECLARED
659659 #ifndef Tk_GetJoinStyle_TCL_DECLARED
660660 #define Tk_GetJoinStyle_TCL_DECLARED
661661 /* 100 */
662 EXTERN int Tk_GetJoinStyle (Tcl_Interp * interp,
663 CONST char * str, int * joinPtr);
662 EXTERN int Tk_GetJoinStyle (Tcl_Interp * interp,
663 const char * str, int * joinPtr);
664664 #endif
665665 #ifndef Tk_GetJustify_TCL_DECLARED
666666 #define Tk_GetJustify_TCL_DECLARED
667667 /* 101 */
668 EXTERN int Tk_GetJustify (Tcl_Interp * interp, CONST char * str,
668 EXTERN int Tk_GetJustify (Tcl_Interp * interp, const char * str,
669669 Tk_Justify * justifyPtr);
670670 #endif
671671 #ifndef Tk_GetNumMainWindows_TCL_DECLARED
676676 #ifndef Tk_GetOption_TCL_DECLARED
677677 #define Tk_GetOption_TCL_DECLARED
678678 /* 103 */
679 EXTERN Tk_Uid Tk_GetOption (Tk_Window tkwin, CONST char * name,
680 CONST char * className);
679 EXTERN Tk_Uid Tk_GetOption (Tk_Window tkwin, const char * name,
680 const char * className);
681681 #endif
682682 #ifndef Tk_GetPixels_TCL_DECLARED
683683 #define Tk_GetPixels_TCL_DECLARED
684684 /* 104 */
685 EXTERN int Tk_GetPixels (Tcl_Interp * interp, Tk_Window tkwin,
686 CONST char * str, int * intPtr);
685 EXTERN int Tk_GetPixels (Tcl_Interp * interp, Tk_Window tkwin,
686 const char * str, int * intPtr);
687687 #endif
688688 #ifndef Tk_GetPixmap_TCL_DECLARED
689689 #define Tk_GetPixmap_TCL_DECLARED
690690 /* 105 */
691 EXTERN Pixmap Tk_GetPixmap (Display * display, Drawable d,
691 EXTERN Pixmap Tk_GetPixmap (Display * display, Drawable d,
692692 int width, int height, int depth);
693693 #endif
694694 #ifndef Tk_GetRelief_TCL_DECLARED
695695 #define Tk_GetRelief_TCL_DECLARED
696696 /* 106 */
697 EXTERN int Tk_GetRelief (Tcl_Interp * interp, CONST char * name,
697 EXTERN int Tk_GetRelief (Tcl_Interp * interp, const char * name,
698698 int * reliefPtr);
699699 #endif
700700 #ifndef Tk_GetRootCoords_TCL_DECLARED
701701 #define Tk_GetRootCoords_TCL_DECLARED
702702 /* 107 */
703 EXTERN void Tk_GetRootCoords (Tk_Window tkwin, int * xPtr,
703 EXTERN void Tk_GetRootCoords (Tk_Window tkwin, int * xPtr,
704704 int * yPtr);
705705 #endif
706706 #ifndef Tk_GetScrollInfo_TCL_DECLARED
707707 #define Tk_GetScrollInfo_TCL_DECLARED
708708 /* 108 */
709 EXTERN int Tk_GetScrollInfo (Tcl_Interp * interp, int argc,
710 CONST84 char ** argv, double * dblPtr,
709 EXTERN int Tk_GetScrollInfo (Tcl_Interp * interp, int argc,
710 CONST84 char ** argv, double * dblPtr,
711711 int * intPtr);
712712 #endif
713713 #ifndef Tk_GetScreenMM_TCL_DECLARED
714714 #define Tk_GetScreenMM_TCL_DECLARED
715715 /* 109 */
716 EXTERN int Tk_GetScreenMM (Tcl_Interp * interp, Tk_Window tkwin,
717 CONST char * str, double * doublePtr);
716 EXTERN int Tk_GetScreenMM (Tcl_Interp * interp, Tk_Window tkwin,
717 const char * str, double * doublePtr);
718718 #endif
719719 #ifndef Tk_GetSelection_TCL_DECLARED
720720 #define Tk_GetSelection_TCL_DECLARED
721721 /* 110 */
722 EXTERN int Tk_GetSelection (Tcl_Interp * interp,
723 Tk_Window tkwin, Atom selection, Atom target,
722 EXTERN int Tk_GetSelection (Tcl_Interp * interp,
723 Tk_Window tkwin, Atom selection, Atom target,
724724 Tk_GetSelProc * proc, ClientData clientData);
725725 #endif
726726 #ifndef Tk_GetUid_TCL_DECLARED
727727 #define Tk_GetUid_TCL_DECLARED
728728 /* 111 */
729 EXTERN Tk_Uid Tk_GetUid (CONST char * str);
729 EXTERN Tk_Uid Tk_GetUid (const char * str);
730730 #endif
731731 #ifndef Tk_GetVisual_TCL_DECLARED
732732 #define Tk_GetVisual_TCL_DECLARED
733733 /* 112 */
734 EXTERN Visual * Tk_GetVisual (Tcl_Interp * interp, Tk_Window tkwin,
735 CONST char * str, int * depthPtr,
734 EXTERN Visual * Tk_GetVisual (Tcl_Interp * interp, Tk_Window tkwin,
735 const char * str, int * depthPtr,
736736 Colormap * colormapPtr);
737737 #endif
738738 #ifndef Tk_GetVRootGeometry_TCL_DECLARED
739739 #define Tk_GetVRootGeometry_TCL_DECLARED
740740 /* 113 */
741 EXTERN void Tk_GetVRootGeometry (Tk_Window tkwin, int * xPtr,
741 EXTERN void Tk_GetVRootGeometry (Tk_Window tkwin, int * xPtr,
742742 int * yPtr, int * widthPtr, int * heightPtr);
743743 #endif
744744 #ifndef Tk_Grab_TCL_DECLARED
745745 #define Tk_Grab_TCL_DECLARED
746746 /* 114 */
747 EXTERN int Tk_Grab (Tcl_Interp * interp, Tk_Window tkwin,
747 EXTERN int Tk_Grab (Tcl_Interp * interp, Tk_Window tkwin,
748748 int grabGlobal);
749749 #endif
750750 #ifndef Tk_HandleEvent_TCL_DECLARED
760760 #ifndef Tk_ImageChanged_TCL_DECLARED
761761 #define Tk_ImageChanged_TCL_DECLARED
762762 /* 117 */
763 EXTERN void Tk_ImageChanged (Tk_ImageMaster master, int x, int y,
764 int width, int height, int imageWidth,
763 EXTERN void Tk_ImageChanged (Tk_ImageMaster master, int x, int y,
764 int width, int height, int imageWidth,
765765 int imageHeight);
766766 #endif
767767 #ifndef Tk_Init_TCL_DECLARED
772772 #ifndef Tk_InternAtom_TCL_DECLARED
773773 #define Tk_InternAtom_TCL_DECLARED
774774 /* 119 */
775 EXTERN Atom Tk_InternAtom (Tk_Window tkwin, CONST char * name);
775 EXTERN Atom Tk_InternAtom (Tk_Window tkwin, const char * name);
776776 #endif
777777 #ifndef Tk_IntersectTextLayout_TCL_DECLARED
778778 #define Tk_IntersectTextLayout_TCL_DECLARED
779779 /* 120 */
780 EXTERN int Tk_IntersectTextLayout (Tk_TextLayout layout, int x,
780 EXTERN int Tk_IntersectTextLayout (Tk_TextLayout layout, int x,
781781 int y, int width, int height);
782782 #endif
783783 #ifndef Tk_MaintainGeometry_TCL_DECLARED
784784 #define Tk_MaintainGeometry_TCL_DECLARED
785785 /* 121 */
786 EXTERN void Tk_MaintainGeometry (Tk_Window slave,
787 Tk_Window master, int x, int y, int width,
786 EXTERN void Tk_MaintainGeometry (Tk_Window slave,
787 Tk_Window master, int x, int y, int width,
788788 int height);
789789 #endif
790790 #ifndef Tk_MainWindow_TCL_DECLARED
800800 #ifndef Tk_ManageGeometry_TCL_DECLARED
801801 #define Tk_ManageGeometry_TCL_DECLARED
802802 /* 124 */
803 EXTERN void Tk_ManageGeometry (Tk_Window tkwin,
804 CONST Tk_GeomMgr * mgrPtr,
803 EXTERN void Tk_ManageGeometry (Tk_Window tkwin,
804 const Tk_GeomMgr * mgrPtr,
805805 ClientData clientData);
806806 #endif
807807 #ifndef Tk_MapWindow_TCL_DECLARED
812812 #ifndef Tk_MeasureChars_TCL_DECLARED
813813 #define Tk_MeasureChars_TCL_DECLARED
814814 /* 126 */
815 EXTERN int Tk_MeasureChars (Tk_Font tkfont, CONST char * source,
816 int numBytes, int maxPixels, int flags,
815 EXTERN int Tk_MeasureChars (Tk_Font tkfont, const char * source,
816 int numBytes, int maxPixels, int flags,
817817 int * lengthPtr);
818818 #endif
819819 #ifndef Tk_MoveResizeWindow_TCL_DECLARED
820820 #define Tk_MoveResizeWindow_TCL_DECLARED
821821 /* 127 */
822 EXTERN void Tk_MoveResizeWindow (Tk_Window tkwin, int x, int y,
822 EXTERN void Tk_MoveResizeWindow (Tk_Window tkwin, int x, int y,
823823 int width, int height);
824824 #endif
825825 #ifndef Tk_MoveWindow_TCL_DECLARED
845845 #ifndef Tk_NameOfBitmap_TCL_DECLARED
846846 #define Tk_NameOfBitmap_TCL_DECLARED
847847 /* 132 */
848 EXTERN CONST84_RETURN char * Tk_NameOfBitmap (Display * display,
848 EXTERN CONST84_RETURN char * Tk_NameOfBitmap (Display * display,
849849 Pixmap bitmap);
850850 #endif
851851 #ifndef Tk_NameOfCapStyle_TCL_DECLARED
861861 #ifndef Tk_NameOfCursor_TCL_DECLARED
862862 #define Tk_NameOfCursor_TCL_DECLARED
863863 /* 135 */
864 EXTERN CONST84_RETURN char * Tk_NameOfCursor (Display * display,
864 EXTERN CONST84_RETURN char * Tk_NameOfCursor (Display * display,
865865 Tk_Cursor cursor);
866866 #endif
867867 #ifndef Tk_NameOfFont_TCL_DECLARED
892892 #ifndef Tk_NameToWindow_TCL_DECLARED
893893 #define Tk_NameToWindow_TCL_DECLARED
894894 /* 141 */
895 EXTERN Tk_Window Tk_NameToWindow (Tcl_Interp * interp,
896 CONST char * pathName, Tk_Window tkwin);
895 EXTERN Tk_Window Tk_NameToWindow (Tcl_Interp * interp,
896 const char * pathName, Tk_Window tkwin);
897897 #endif
898898 #ifndef Tk_OwnSelection_TCL_DECLARED
899899 #define Tk_OwnSelection_TCL_DECLARED
900900 /* 142 */
901 EXTERN void Tk_OwnSelection (Tk_Window tkwin, Atom selection,
901 EXTERN void Tk_OwnSelection (Tk_Window tkwin, Atom selection,
902902 Tk_LostSelProc * proc, ClientData clientData);
903903 #endif
904904 #ifndef Tk_ParseArgv_TCL_DECLARED
905905 #define Tk_ParseArgv_TCL_DECLARED
906906 /* 143 */
907 EXTERN int Tk_ParseArgv (Tcl_Interp * interp, Tk_Window tkwin,
908 int * argcPtr, CONST84 char ** argv,
909 Tk_ArgvInfo * argTable, int flags);
907 EXTERN int Tk_ParseArgv (Tcl_Interp * interp, Tk_Window tkwin,
908 int * argcPtr, CONST84 char ** argv,
909 const Tk_ArgvInfo * argTable, int flags);
910910 #endif
911911 #ifndef Tk_PhotoPutBlock_NoComposite_TCL_DECLARED
912912 #define Tk_PhotoPutBlock_NoComposite_TCL_DECLARED
913913 /* 144 */
914 EXTERN void Tk_PhotoPutBlock_NoComposite (Tk_PhotoHandle handle,
915 Tk_PhotoImageBlock * blockPtr, int x, int y,
914 EXTERN void Tk_PhotoPutBlock_NoComposite (Tk_PhotoHandle handle,
915 Tk_PhotoImageBlock * blockPtr, int x, int y,
916916 int width, int height);
917917 #endif
918918 #ifndef Tk_PhotoPutZoomedBlock_NoComposite_TCL_DECLARED
919919 #define Tk_PhotoPutZoomedBlock_NoComposite_TCL_DECLARED
920920 /* 145 */
921921 EXTERN void Tk_PhotoPutZoomedBlock_NoComposite (
922 Tk_PhotoHandle handle,
923 Tk_PhotoImageBlock * blockPtr, int x, int y,
924 int width, int height, int zoomX, int zoomY,
922 Tk_PhotoHandle handle,
923 Tk_PhotoImageBlock * blockPtr, int x, int y,
924 int width, int height, int zoomX, int zoomY,
925925 int subsampleX, int subsampleY);
926926 #endif
927927 #ifndef Tk_PhotoGetImage_TCL_DECLARED
928928 #define Tk_PhotoGetImage_TCL_DECLARED
929929 /* 146 */
930 EXTERN int Tk_PhotoGetImage (Tk_PhotoHandle handle,
930 EXTERN int Tk_PhotoGetImage (Tk_PhotoHandle handle,
931931 Tk_PhotoImageBlock * blockPtr);
932932 #endif
933933 #ifndef Tk_PhotoBlank_TCL_DECLARED
938938 #ifndef Tk_PhotoExpand_Panic_TCL_DECLARED
939939 #define Tk_PhotoExpand_Panic_TCL_DECLARED
940940 /* 148 */
941 EXTERN void Tk_PhotoExpand_Panic (Tk_PhotoHandle handle,
941 EXTERN void Tk_PhotoExpand_Panic (Tk_PhotoHandle handle,
942942 int width, int height);
943943 #endif
944944 #ifndef Tk_PhotoGetSize_TCL_DECLARED
945945 #define Tk_PhotoGetSize_TCL_DECLARED
946946 /* 149 */
947 EXTERN void Tk_PhotoGetSize (Tk_PhotoHandle handle,
947 EXTERN void Tk_PhotoGetSize (Tk_PhotoHandle handle,
948948 int * widthPtr, int * heightPtr);
949949 #endif
950950 #ifndef Tk_PhotoSetSize_Panic_TCL_DECLARED
951951 #define Tk_PhotoSetSize_Panic_TCL_DECLARED
952952 /* 150 */
953 EXTERN void Tk_PhotoSetSize_Panic (Tk_PhotoHandle handle,
953 EXTERN void Tk_PhotoSetSize_Panic (Tk_PhotoHandle handle,
954954 int width, int height);
955955 #endif
956956 #ifndef Tk_PointToChar_TCL_DECLARED
961961 #ifndef Tk_PostscriptFontName_TCL_DECLARED
962962 #define Tk_PostscriptFontName_TCL_DECLARED
963963 /* 152 */
964 EXTERN int Tk_PostscriptFontName (Tk_Font tkfont,
964 EXTERN int Tk_PostscriptFontName (Tk_Font tkfont,
965965 Tcl_DString * dsPtr);
966966 #endif
967967 #ifndef Tk_PreserveColormap_TCL_DECLARED
968968 #define Tk_PreserveColormap_TCL_DECLARED
969969 /* 153 */
970 EXTERN void Tk_PreserveColormap (Display * display,
970 EXTERN void Tk_PreserveColormap (Display * display,
971971 Colormap colormap);
972972 #endif
973973 #ifndef Tk_QueueWindowEvent_TCL_DECLARED
974974 #define Tk_QueueWindowEvent_TCL_DECLARED
975975 /* 154 */
976 EXTERN void Tk_QueueWindowEvent (XEvent * eventPtr,
976 EXTERN void Tk_QueueWindowEvent (XEvent * eventPtr,
977977 Tcl_QueuePosition position);
978978 #endif
979979 #ifndef Tk_RedrawImage_TCL_DECLARED
980980 #define Tk_RedrawImage_TCL_DECLARED
981981 /* 155 */
982 EXTERN void Tk_RedrawImage (Tk_Image image, int imageX,
983 int imageY, int width, int height,
984 Drawable drawable, int drawableX,
982 EXTERN void Tk_RedrawImage (Tk_Image image, int imageX,
983 int imageY, int width, int height,
984 Drawable drawable, int drawableX,
985985 int drawableY);
986986 #endif
987987 #ifndef Tk_ResizeWindow_TCL_DECLARED
988988 #define Tk_ResizeWindow_TCL_DECLARED
989989 /* 156 */
990 EXTERN void Tk_ResizeWindow (Tk_Window tkwin, int width,
990 EXTERN void Tk_ResizeWindow (Tk_Window tkwin, int width,
991991 int height);
992992 #endif
993993 #ifndef Tk_RestackWindow_TCL_DECLARED
994994 #define Tk_RestackWindow_TCL_DECLARED
995995 /* 157 */
996 EXTERN int Tk_RestackWindow (Tk_Window tkwin, int aboveBelow,
996 EXTERN int Tk_RestackWindow (Tk_Window tkwin, int aboveBelow,
997997 Tk_Window other);
998998 #endif
999999 #ifndef Tk_RestrictEvents_TCL_DECLARED
10001000 #define Tk_RestrictEvents_TCL_DECLARED
10011001 /* 158 */
1002 EXTERN Tk_RestrictProc * Tk_RestrictEvents (Tk_RestrictProc * proc,
1002 EXTERN Tk_RestrictProc * Tk_RestrictEvents (Tk_RestrictProc * proc,
10031003 ClientData arg, ClientData * prevArgPtr);
10041004 #endif
10051005 #ifndef Tk_SafeInit_TCL_DECLARED
10101010 #ifndef Tk_SetAppName_TCL_DECLARED
10111011 #define Tk_SetAppName_TCL_DECLARED
10121012 /* 160 */
1013 EXTERN CONST char * Tk_SetAppName (Tk_Window tkwin, CONST char * name);
1013 EXTERN const char * Tk_SetAppName (Tk_Window tkwin, const char * name);
10141014 #endif
10151015 #ifndef Tk_SetBackgroundFromBorder_TCL_DECLARED
10161016 #define Tk_SetBackgroundFromBorder_TCL_DECLARED
10171017 /* 161 */
1018 EXTERN void Tk_SetBackgroundFromBorder (Tk_Window tkwin,
1018 EXTERN void Tk_SetBackgroundFromBorder (Tk_Window tkwin,
10191019 Tk_3DBorder border);
10201020 #endif
10211021 #ifndef Tk_SetClass_TCL_DECLARED
10221022 #define Tk_SetClass_TCL_DECLARED
10231023 /* 162 */
1024 EXTERN void Tk_SetClass (Tk_Window tkwin, CONST char * className);
1024 EXTERN void Tk_SetClass (Tk_Window tkwin, const char * className);
10251025 #endif
10261026 #ifndef Tk_SetGrid_TCL_DECLARED
10271027 #define Tk_SetGrid_TCL_DECLARED
10281028 /* 163 */
1029 EXTERN void Tk_SetGrid (Tk_Window tkwin, int reqWidth,
1029 EXTERN void Tk_SetGrid (Tk_Window tkwin, int reqWidth,
10301030 int reqHeight, int gridWidth, int gridHeight);
10311031 #endif
10321032 #ifndef Tk_SetInternalBorder_TCL_DECLARED
10371037 #ifndef Tk_SetWindowBackground_TCL_DECLARED
10381038 #define Tk_SetWindowBackground_TCL_DECLARED
10391039 /* 165 */
1040 EXTERN void Tk_SetWindowBackground (Tk_Window tkwin,
1040 EXTERN void Tk_SetWindowBackground (Tk_Window tkwin,
10411041 unsigned long pixel);
10421042 #endif
10431043 #ifndef Tk_SetWindowBackgroundPixmap_TCL_DECLARED
10441044 #define Tk_SetWindowBackgroundPixmap_TCL_DECLARED
10451045 /* 166 */
1046 EXTERN void Tk_SetWindowBackgroundPixmap (Tk_Window tkwin,
1046 EXTERN void Tk_SetWindowBackgroundPixmap (Tk_Window tkwin,
10471047 Pixmap pixmap);
10481048 #endif
10491049 #ifndef Tk_SetWindowBorder_TCL_DECLARED
10501050 #define Tk_SetWindowBorder_TCL_DECLARED
10511051 /* 167 */
1052 EXTERN void Tk_SetWindowBorder (Tk_Window tkwin,
1052 EXTERN void Tk_SetWindowBorder (Tk_Window tkwin,
10531053 unsigned long pixel);
10541054 #endif
10551055 #ifndef Tk_SetWindowBorderWidth_TCL_DECLARED
10601060 #ifndef Tk_SetWindowBorderPixmap_TCL_DECLARED
10611061 #define Tk_SetWindowBorderPixmap_TCL_DECLARED
10621062 /* 169 */
1063 EXTERN void Tk_SetWindowBorderPixmap (Tk_Window tkwin,
1063 EXTERN void Tk_SetWindowBorderPixmap (Tk_Window tkwin,
10641064 Pixmap pixmap);
10651065 #endif
10661066 #ifndef Tk_SetWindowColormap_TCL_DECLARED
10671067 #define Tk_SetWindowColormap_TCL_DECLARED
10681068 /* 170 */
1069 EXTERN void Tk_SetWindowColormap (Tk_Window tkwin,
1069 EXTERN void Tk_SetWindowColormap (Tk_Window tkwin,
10701070 Colormap colormap);
10711071 #endif
10721072 #ifndef Tk_SetWindowVisual_TCL_DECLARED
10731073 #define Tk_SetWindowVisual_TCL_DECLARED
10741074 /* 171 */
1075 EXTERN int Tk_SetWindowVisual (Tk_Window tkwin, Visual * visual,
1075 EXTERN int Tk_SetWindowVisual (Tk_Window tkwin, Visual * visual,
10761076 int depth, Colormap colormap);
10771077 #endif
10781078 #ifndef Tk_SizeOfBitmap_TCL_DECLARED
10791079 #define Tk_SizeOfBitmap_TCL_DECLARED
10801080 /* 172 */
1081 EXTERN void Tk_SizeOfBitmap (Display * display, Pixmap bitmap,
1081 EXTERN void Tk_SizeOfBitmap (Display * display, Pixmap bitmap,
10821082 int * widthPtr, int * heightPtr);
10831083 #endif
10841084 #ifndef Tk_SizeOfImage_TCL_DECLARED
10851085 #define Tk_SizeOfImage_TCL_DECLARED
10861086 /* 173 */
1087 EXTERN void Tk_SizeOfImage (Tk_Image image, int * widthPtr,
1087 EXTERN void Tk_SizeOfImage (Tk_Image image, int * widthPtr,
10881088 int * heightPtr);
10891089 #endif
10901090 #ifndef Tk_StrictMotif_TCL_DECLARED
10951095 #ifndef Tk_TextLayoutToPostscript_TCL_DECLARED
10961096 #define Tk_TextLayoutToPostscript_TCL_DECLARED
10971097 /* 175 */
1098 EXTERN void Tk_TextLayoutToPostscript (Tcl_Interp * interp,
1098 EXTERN void Tk_TextLayoutToPostscript (Tcl_Interp * interp,
10991099 Tk_TextLayout layout);
11001100 #endif
11011101 #ifndef Tk_TextWidth_TCL_DECLARED
11021102 #define Tk_TextWidth_TCL_DECLARED
11031103 /* 176 */
1104 EXTERN int Tk_TextWidth (Tk_Font font, CONST char * str,
1104 EXTERN int Tk_TextWidth (Tk_Font font, const char * str,
11051105 int numBytes);
11061106 #endif
11071107 #ifndef Tk_UndefineCursor_TCL_DECLARED
11121112 #ifndef Tk_UnderlineChars_TCL_DECLARED
11131113 #define Tk_UnderlineChars_TCL_DECLARED
11141114 /* 178 */
1115 EXTERN void Tk_UnderlineChars (Display * display,
1116 Drawable drawable, GC gc, Tk_Font tkfont,
1117 CONST char * source, int x, int y,
1115 EXTERN void Tk_UnderlineChars (Display * display,
1116 Drawable drawable, GC gc, Tk_Font tkfont,
1117 const char * source, int x, int y,
11181118 int firstByte, int lastByte);
11191119 #endif
11201120 #ifndef Tk_UnderlineTextLayout_TCL_DECLARED
11211121 #define Tk_UnderlineTextLayout_TCL_DECLARED
11221122 /* 179 */
1123 EXTERN void Tk_UnderlineTextLayout (Display * display,
1124 Drawable drawable, GC gc,
1125 Tk_TextLayout layout, int x, int y,
1123 EXTERN void Tk_UnderlineTextLayout (Display * display,
1124 Drawable drawable, GC gc,
1125 Tk_TextLayout layout, int x, int y,
11261126 int underline);
11271127 #endif
11281128 #ifndef Tk_Ungrab_TCL_DECLARED
11331133 #ifndef Tk_UnmaintainGeometry_TCL_DECLARED
11341134 #define Tk_UnmaintainGeometry_TCL_DECLARED
11351135 /* 181 */
1136 EXTERN void Tk_UnmaintainGeometry (Tk_Window slave,
1136 EXTERN void Tk_UnmaintainGeometry (Tk_Window slave,
11371137 Tk_Window master);
11381138 #endif
11391139 #ifndef Tk_UnmapWindow_TCL_DECLARED
11491149 #ifndef Tk_UpdatePointer_TCL_DECLARED
11501150 #define Tk_UpdatePointer_TCL_DECLARED
11511151 /* 184 */
1152 EXTERN void Tk_UpdatePointer (Tk_Window tkwin, int x, int y,
1152 EXTERN void Tk_UpdatePointer (Tk_Window tkwin, int x, int y,
11531153 int state);
11541154 #endif
11551155 #ifndef Tk_AllocBitmapFromObj_TCL_DECLARED
11561156 #define Tk_AllocBitmapFromObj_TCL_DECLARED
11571157 /* 185 */
1158 EXTERN Pixmap Tk_AllocBitmapFromObj (Tcl_Interp * interp,
1158 EXTERN Pixmap Tk_AllocBitmapFromObj (Tcl_Interp * interp,
11591159 Tk_Window tkwin, Tcl_Obj * objPtr);
11601160 #endif
11611161 #ifndef Tk_Alloc3DBorderFromObj_TCL_DECLARED
11621162 #define Tk_Alloc3DBorderFromObj_TCL_DECLARED
11631163 /* 186 */
1164 EXTERN Tk_3DBorder Tk_Alloc3DBorderFromObj (Tcl_Interp * interp,
1164 EXTERN Tk_3DBorder Tk_Alloc3DBorderFromObj (Tcl_Interp * interp,
11651165 Tk_Window tkwin, Tcl_Obj * objPtr);
11661166 #endif
11671167 #ifndef Tk_AllocColorFromObj_TCL_DECLARED
11681168 #define Tk_AllocColorFromObj_TCL_DECLARED
11691169 /* 187 */
1170 EXTERN XColor * Tk_AllocColorFromObj (Tcl_Interp * interp,
1170 EXTERN XColor * Tk_AllocColorFromObj (Tcl_Interp * interp,
11711171 Tk_Window tkwin, Tcl_Obj * objPtr);
11721172 #endif
11731173 #ifndef Tk_AllocCursorFromObj_TCL_DECLARED
11741174 #define Tk_AllocCursorFromObj_TCL_DECLARED
11751175 /* 188 */
1176 EXTERN Tk_Cursor Tk_AllocCursorFromObj (Tcl_Interp * interp,
1176 EXTERN Tk_Cursor Tk_AllocCursorFromObj (Tcl_Interp * interp,
11771177 Tk_Window tkwin, Tcl_Obj * objPtr);
11781178 #endif
11791179 #ifndef Tk_AllocFontFromObj_TCL_DECLARED
11801180 #define Tk_AllocFontFromObj_TCL_DECLARED
11811181 /* 189 */
1182 EXTERN Tk_Font Tk_AllocFontFromObj (Tcl_Interp * interp,
1182 EXTERN Tk_Font Tk_AllocFontFromObj (Tcl_Interp * interp,
11831183 Tk_Window tkwin, Tcl_Obj * objPtr);
11841184 #endif
11851185 #ifndef Tk_CreateOptionTable_TCL_DECLARED
11861186 #define Tk_CreateOptionTable_TCL_DECLARED
11871187 /* 190 */
1188 EXTERN Tk_OptionTable Tk_CreateOptionTable (Tcl_Interp * interp,
1189 CONST Tk_OptionSpec * templatePtr);
1188 EXTERN Tk_OptionTable Tk_CreateOptionTable (Tcl_Interp * interp,
1189 const Tk_OptionSpec * templatePtr);
11901190 #endif
11911191 #ifndef Tk_DeleteOptionTable_TCL_DECLARED
11921192 #define Tk_DeleteOptionTable_TCL_DECLARED
11961196 #ifndef Tk_Free3DBorderFromObj_TCL_DECLARED
11971197 #define Tk_Free3DBorderFromObj_TCL_DECLARED
11981198 /* 192 */
1199 EXTERN void Tk_Free3DBorderFromObj (Tk_Window tkwin,
1199 EXTERN void Tk_Free3DBorderFromObj (Tk_Window tkwin,
12001200 Tcl_Obj * objPtr);
12011201 #endif
12021202 #ifndef Tk_FreeBitmapFromObj_TCL_DECLARED
12031203 #define Tk_FreeBitmapFromObj_TCL_DECLARED
12041204 /* 193 */
1205 EXTERN void Tk_FreeBitmapFromObj (Tk_Window tkwin,
1205 EXTERN void Tk_FreeBitmapFromObj (Tk_Window tkwin,
12061206 Tcl_Obj * objPtr);
12071207 #endif
12081208 #ifndef Tk_FreeColorFromObj_TCL_DECLARED
12091209 #define Tk_FreeColorFromObj_TCL_DECLARED
12101210 /* 194 */
1211 EXTERN void Tk_FreeColorFromObj (Tk_Window tkwin,
1211 EXTERN void Tk_FreeColorFromObj (Tk_Window tkwin,
12121212 Tcl_Obj * objPtr);
12131213 #endif
12141214 #ifndef Tk_FreeConfigOptions_TCL_DECLARED
12151215 #define Tk_FreeConfigOptions_TCL_DECLARED
12161216 /* 195 */
1217 EXTERN void Tk_FreeConfigOptions (char * recordPtr,
1217 EXTERN void Tk_FreeConfigOptions (char * recordPtr,
12181218 Tk_OptionTable optionToken, Tk_Window tkwin);
12191219 #endif
12201220 #ifndef Tk_FreeSavedOptions_TCL_DECLARED
12251225 #ifndef Tk_FreeCursorFromObj_TCL_DECLARED
12261226 #define Tk_FreeCursorFromObj_TCL_DECLARED
12271227 /* 197 */
1228 EXTERN void Tk_FreeCursorFromObj (Tk_Window tkwin,
1228 EXTERN void Tk_FreeCursorFromObj (Tk_Window tkwin,
12291229 Tcl_Obj * objPtr);
12301230 #endif
12311231 #ifndef Tk_FreeFontFromObj_TCL_DECLARED
12321232 #define Tk_FreeFontFromObj_TCL_DECLARED
12331233 /* 198 */
1234 EXTERN void Tk_FreeFontFromObj (Tk_Window tkwin,
1234 EXTERN void Tk_FreeFontFromObj (Tk_Window tkwin,
12351235 Tcl_Obj * objPtr);
12361236 #endif
12371237 #ifndef Tk_Get3DBorderFromObj_TCL_DECLARED
12381238 #define Tk_Get3DBorderFromObj_TCL_DECLARED
12391239 /* 199 */
1240 EXTERN Tk_3DBorder Tk_Get3DBorderFromObj (Tk_Window tkwin,
1240 EXTERN Tk_3DBorder Tk_Get3DBorderFromObj (Tk_Window tkwin,
12411241 Tcl_Obj * objPtr);
12421242 #endif
12431243 #ifndef Tk_GetAnchorFromObj_TCL_DECLARED
12441244 #define Tk_GetAnchorFromObj_TCL_DECLARED
12451245 /* 200 */
1246 EXTERN int Tk_GetAnchorFromObj (Tcl_Interp * interp,
1246 EXTERN int Tk_GetAnchorFromObj (Tcl_Interp * interp,
12471247 Tcl_Obj * objPtr, Tk_Anchor * anchorPtr);
12481248 #endif
12491249 #ifndef Tk_GetBitmapFromObj_TCL_DECLARED
12501250 #define Tk_GetBitmapFromObj_TCL_DECLARED
12511251 /* 201 */
1252 EXTERN Pixmap Tk_GetBitmapFromObj (Tk_Window tkwin,
1252 EXTERN Pixmap Tk_GetBitmapFromObj (Tk_Window tkwin,
12531253 Tcl_Obj * objPtr);
12541254 #endif
12551255 #ifndef Tk_GetColorFromObj_TCL_DECLARED
12561256 #define Tk_GetColorFromObj_TCL_DECLARED
12571257 /* 202 */
1258 EXTERN XColor * Tk_GetColorFromObj (Tk_Window tkwin,
1258 EXTERN XColor * Tk_GetColorFromObj (Tk_Window tkwin,
12591259 Tcl_Obj * objPtr);
12601260 #endif
12611261 #ifndef Tk_GetCursorFromObj_TCL_DECLARED
12621262 #define Tk_GetCursorFromObj_TCL_DECLARED
12631263 /* 203 */
1264 EXTERN Tk_Cursor Tk_GetCursorFromObj (Tk_Window tkwin,
1264 EXTERN Tk_Cursor Tk_GetCursorFromObj (Tk_Window tkwin,
12651265 Tcl_Obj * objPtr);
12661266 #endif
12671267 #ifndef Tk_GetOptionInfo_TCL_DECLARED
12681268 #define Tk_GetOptionInfo_TCL_DECLARED
12691269 /* 204 */
1270 EXTERN Tcl_Obj * Tk_GetOptionInfo (Tcl_Interp * interp,
1271 char * recordPtr, Tk_OptionTable optionTable,
1270 EXTERN Tcl_Obj * Tk_GetOptionInfo (Tcl_Interp * interp,
1271 char * recordPtr, Tk_OptionTable optionTable,
12721272 Tcl_Obj * namePtr, Tk_Window tkwin);
12731273 #endif
12741274 #ifndef Tk_GetOptionValue_TCL_DECLARED
12751275 #define Tk_GetOptionValue_TCL_DECLARED
12761276 /* 205 */
1277 EXTERN Tcl_Obj * Tk_GetOptionValue (Tcl_Interp * interp,
1278 char * recordPtr, Tk_OptionTable optionTable,
1277 EXTERN Tcl_Obj * Tk_GetOptionValue (Tcl_Interp * interp,
1278 char * recordPtr, Tk_OptionTable optionTable,
12791279 Tcl_Obj * namePtr, Tk_Window tkwin);
12801280 #endif
12811281 #ifndef Tk_GetJustifyFromObj_TCL_DECLARED
12821282 #define Tk_GetJustifyFromObj_TCL_DECLARED
12831283 /* 206 */
1284 EXTERN int Tk_GetJustifyFromObj (Tcl_Interp * interp,
1284 EXTERN int Tk_GetJustifyFromObj (Tcl_Interp * interp,
12851285 Tcl_Obj * objPtr, Tk_Justify * justifyPtr);
12861286 #endif
12871287 #ifndef Tk_GetMMFromObj_TCL_DECLARED
12881288 #define Tk_GetMMFromObj_TCL_DECLARED
12891289 /* 207 */
1290 EXTERN int Tk_GetMMFromObj (Tcl_Interp * interp,
1291 Tk_Window tkwin, Tcl_Obj * objPtr,
1290 EXTERN int Tk_GetMMFromObj (Tcl_Interp * interp,
1291 Tk_Window tkwin, Tcl_Obj * objPtr,
12921292 double * doublePtr);
12931293 #endif
12941294 #ifndef Tk_GetPixelsFromObj_TCL_DECLARED
12951295 #define Tk_GetPixelsFromObj_TCL_DECLARED
12961296 /* 208 */
1297 EXTERN int Tk_GetPixelsFromObj (Tcl_Interp * interp,
1298 Tk_Window tkwin, Tcl_Obj * objPtr,
1297 EXTERN int Tk_GetPixelsFromObj (Tcl_Interp * interp,
1298 Tk_Window tkwin, Tcl_Obj * objPtr,
12991299 int * intPtr);
13001300 #endif
13011301 #ifndef Tk_GetReliefFromObj_TCL_DECLARED
13021302 #define Tk_GetReliefFromObj_TCL_DECLARED
13031303 /* 209 */
1304 EXTERN int Tk_GetReliefFromObj (Tcl_Interp * interp,
1304 EXTERN int Tk_GetReliefFromObj (Tcl_Interp * interp,
13051305 Tcl_Obj * objPtr, int * resultPtr);
13061306 #endif
13071307 #ifndef Tk_GetScrollInfoObj_TCL_DECLARED
13081308 #define Tk_GetScrollInfoObj_TCL_DECLARED
13091309 /* 210 */
1310 EXTERN int Tk_GetScrollInfoObj (Tcl_Interp * interp, int objc,
1311 Tcl_Obj *CONST objv[], double * dblPtr,
1310 EXTERN int Tk_GetScrollInfoObj (Tcl_Interp * interp, int objc,
1311 Tcl_Obj *const objv[], double * dblPtr,
13121312 int * intPtr);
13131313 #endif
13141314 #ifndef Tk_InitOptions_TCL_DECLARED
13151315 #define Tk_InitOptions_TCL_DECLARED
13161316 /* 211 */
1317 EXTERN int Tk_InitOptions (Tcl_Interp * interp,
1318 char * recordPtr, Tk_OptionTable optionToken,
1317 EXTERN int Tk_InitOptions (Tcl_Interp * interp,
1318 char * recordPtr, Tk_OptionTable optionToken,
13191319 Tk_Window tkwin);
13201320 #endif
13211321 #ifndef Tk_MainEx_TCL_DECLARED
13221322 #define Tk_MainEx_TCL_DECLARED
13231323 /* 212 */
1324 EXTERN void Tk_MainEx (int argc, char ** argv,
1325 Tcl_AppInitProc * appInitProc,
1324 EXTERN void Tk_MainEx (int argc, char ** argv,
1325 Tcl_AppInitProc * appInitProc,
13261326 Tcl_Interp * interp);
13271327 #endif
13281328 #ifndef Tk_RestoreSavedOptions_TCL_DECLARED
13331333 #ifndef Tk_SetOptions_TCL_DECLARED
13341334 #define Tk_SetOptions_TCL_DECLARED
13351335 /* 214 */
1336 EXTERN int Tk_SetOptions (Tcl_Interp * interp, char * recordPtr,
1337 Tk_OptionTable optionTable, int objc,
1338 Tcl_Obj *CONST objv[], Tk_Window tkwin,
1336 EXTERN int Tk_SetOptions (Tcl_Interp * interp, char * recordPtr,
1337 Tk_OptionTable optionTable, int objc,
1338 Tcl_Obj *const objv[], Tk_Window tkwin,
13391339 Tk_SavedOptions * savePtr, int * maskPtr);
13401340 #endif
13411341 #ifndef Tk_InitConsoleChannels_TCL_DECLARED
13511351 #ifndef Tk_CreateSmoothMethod_TCL_DECLARED
13521352 #define Tk_CreateSmoothMethod_TCL_DECLARED
13531353 /* 217 */
1354 EXTERN void Tk_CreateSmoothMethod (Tcl_Interp * interp,
1355 Tk_SmoothMethod * method);
1354 EXTERN void Tk_CreateSmoothMethod (Tcl_Interp * interp,
1355 const Tk_SmoothMethod * method);
13561356 #endif
13571357 /* Slot 218 is reserved */
13581358 /* Slot 219 is reserved */
13591359 #ifndef Tk_GetDash_TCL_DECLARED
13601360 #define Tk_GetDash_TCL_DECLARED
13611361 /* 220 */
1362 EXTERN int Tk_GetDash (Tcl_Interp * interp, CONST char * value,
1362 EXTERN int Tk_GetDash (Tcl_Interp * interp, const char * value,
13631363 Tk_Dash * dash);
13641364 #endif
13651365 #ifndef Tk_CreateOutline_TCL_DECLARED
13701370 #ifndef Tk_DeleteOutline_TCL_DECLARED
13711371 #define Tk_DeleteOutline_TCL_DECLARED
13721372 /* 222 */
1373 EXTERN void Tk_DeleteOutline (Display * display,
1373 EXTERN void Tk_DeleteOutline (Display * display,
13741374 Tk_Outline * outline);
13751375 #endif
13761376 #ifndef Tk_ConfigOutlineGC_TCL_DECLARED
13771377 #define Tk_ConfigOutlineGC_TCL_DECLARED
13781378 /* 223 */
1379 EXTERN int Tk_ConfigOutlineGC (XGCValues * gcValues,
1380 Tk_Canvas canvas, Tk_Item * item,
1379 EXTERN int Tk_ConfigOutlineGC (XGCValues * gcValues,
1380 Tk_Canvas canvas, Tk_Item * item,
13811381 Tk_Outline * outline);
13821382 #endif
13831383 #ifndef Tk_ChangeOutlineGC_TCL_DECLARED
13841384 #define Tk_ChangeOutlineGC_TCL_DECLARED
13851385 /* 224 */
1386 EXTERN int Tk_ChangeOutlineGC (Tk_Canvas canvas, Tk_Item * item,
1386 EXTERN int Tk_ChangeOutlineGC (Tk_Canvas canvas, Tk_Item * item,
13871387 Tk_Outline * outline);
13881388 #endif
13891389 #ifndef Tk_ResetOutlineGC_TCL_DECLARED
13901390 #define Tk_ResetOutlineGC_TCL_DECLARED
13911391 /* 225 */
1392 EXTERN int Tk_ResetOutlineGC (Tk_Canvas canvas, Tk_Item * item,
1392 EXTERN int Tk_ResetOutlineGC (Tk_Canvas canvas, Tk_Item * item,
13931393 Tk_Outline * outline);
13941394 #endif
13951395 #ifndef Tk_CanvasPsOutline_TCL_DECLARED
13961396 #define Tk_CanvasPsOutline_TCL_DECLARED
13971397 /* 226 */
1398 EXTERN int Tk_CanvasPsOutline (Tk_Canvas canvas, Tk_Item * item,
1398 EXTERN int Tk_CanvasPsOutline (Tk_Canvas canvas, Tk_Item * item,
13991399 Tk_Outline * outline);
14001400 #endif
14011401 #ifndef Tk_SetTSOrigin_TCL_DECLARED
14061406 #ifndef Tk_CanvasGetCoordFromObj_TCL_DECLARED
14071407 #define Tk_CanvasGetCoordFromObj_TCL_DECLARED
14081408 /* 228 */
1409 EXTERN int Tk_CanvasGetCoordFromObj (Tcl_Interp * interp,
1410 Tk_Canvas canvas, Tcl_Obj * obj,
1409 EXTERN int Tk_CanvasGetCoordFromObj (Tcl_Interp * interp,
1410 Tk_Canvas canvas, Tcl_Obj * obj,
14111411 double * doublePtr);
14121412 #endif
14131413 #ifndef Tk_CanvasSetOffset_TCL_DECLARED
14141414 #define Tk_CanvasSetOffset_TCL_DECLARED
14151415 /* 229 */
1416 EXTERN void Tk_CanvasSetOffset (Tk_Canvas canvas, GC gc,
1416 EXTERN void Tk_CanvasSetOffset (Tk_Canvas canvas, GC gc,
14171417 Tk_TSOffset * offset);
14181418 #endif
14191419 #ifndef Tk_DitherPhoto_TCL_DECLARED
14201420 #define Tk_DitherPhoto_TCL_DECLARED
14211421 /* 230 */
1422 EXTERN void Tk_DitherPhoto (Tk_PhotoHandle handle, int x, int y,
1422 EXTERN void Tk_DitherPhoto (Tk_PhotoHandle handle, int x, int y,
14231423 int width, int height);
14241424 #endif
14251425 #ifndef Tk_PostscriptBitmap_TCL_DECLARED
14261426 #define Tk_PostscriptBitmap_TCL_DECLARED
14271427 /* 231 */
1428 EXTERN int Tk_PostscriptBitmap (Tcl_Interp * interp,
1429 Tk_Window tkwin, Tk_PostscriptInfo psInfo,
1430 Pixmap bitmap, int startX, int startY,
1428 EXTERN int Tk_PostscriptBitmap (Tcl_Interp * interp,
1429 Tk_Window tkwin, Tk_PostscriptInfo psInfo,
1430 Pixmap bitmap, int startX, int startY,
14311431 int width, int height);
14321432 #endif
14331433 #ifndef Tk_PostscriptColor_TCL_DECLARED
14341434 #define Tk_PostscriptColor_TCL_DECLARED
14351435 /* 232 */
1436 EXTERN int Tk_PostscriptColor (Tcl_Interp * interp,
1436 EXTERN int Tk_PostscriptColor (Tcl_Interp * interp,
14371437 Tk_PostscriptInfo psInfo, XColor * colorPtr);
14381438 #endif
14391439 #ifndef Tk_PostscriptFont_TCL_DECLARED
14401440 #define Tk_PostscriptFont_TCL_DECLARED
14411441 /* 233 */
1442 EXTERN int Tk_PostscriptFont (Tcl_Interp * interp,
1442 EXTERN int Tk_PostscriptFont (Tcl_Interp * interp,
14431443 Tk_PostscriptInfo psInfo, Tk_Font font);
14441444 #endif
14451445 #ifndef Tk_PostscriptImage_TCL_DECLARED
14461446 #define Tk_PostscriptImage_TCL_DECLARED
14471447 /* 234 */
1448 EXTERN int Tk_PostscriptImage (Tk_Image image,
1449 Tcl_Interp * interp, Tk_Window tkwin,
1450 Tk_PostscriptInfo psinfo, int x, int y,
1448 EXTERN int Tk_PostscriptImage (Tk_Image image,
1449 Tcl_Interp * interp, Tk_Window tkwin,
1450 Tk_PostscriptInfo psinfo, int x, int y,
14511451 int width, int height, int prepass);
14521452 #endif
14531453 #ifndef Tk_PostscriptPath_TCL_DECLARED
14541454 #define Tk_PostscriptPath_TCL_DECLARED
14551455 /* 235 */
1456 EXTERN void Tk_PostscriptPath (Tcl_Interp * interp,
1457 Tk_PostscriptInfo psInfo, double * coordPtr,
1456 EXTERN void Tk_PostscriptPath (Tcl_Interp * interp,
1457 Tk_PostscriptInfo psInfo, double * coordPtr,
14581458 int numPoints);
14591459 #endif
14601460 #ifndef Tk_PostscriptStipple_TCL_DECLARED
14611461 #define Tk_PostscriptStipple_TCL_DECLARED
14621462 /* 236 */
1463 EXTERN int Tk_PostscriptStipple (Tcl_Interp * interp,
1464 Tk_Window tkwin, Tk_PostscriptInfo psInfo,
1463 EXTERN int Tk_PostscriptStipple (Tcl_Interp * interp,
1464 Tk_Window tkwin, Tk_PostscriptInfo psInfo,
14651465 Pixmap bitmap);
14661466 #endif
14671467 #ifndef Tk_PostscriptY_TCL_DECLARED
14721472 #ifndef Tk_PostscriptPhoto_TCL_DECLARED
14731473 #define Tk_PostscriptPhoto_TCL_DECLARED
14741474 /* 238 */
1475 EXTERN int Tk_PostscriptPhoto (Tcl_Interp * interp,
1476 Tk_PhotoImageBlock * blockPtr,
1477 Tk_PostscriptInfo psInfo, int width,
1475 EXTERN int Tk_PostscriptPhoto (Tcl_Interp * interp,
1476 Tk_PhotoImageBlock * blockPtr,
1477 Tk_PostscriptInfo psInfo, int width,
14781478 int height);
14791479 #endif
14801480 #ifndef Tk_CreateClientMessageHandler_TCL_DECLARED
14921492 #ifndef Tk_CreateAnonymousWindow_TCL_DECLARED
14931493 #define Tk_CreateAnonymousWindow_TCL_DECLARED
14941494 /* 241 */
1495 EXTERN Tk_Window Tk_CreateAnonymousWindow (Tcl_Interp * interp,
1496 Tk_Window parent, CONST char * screenName);
1495 EXTERN Tk_Window Tk_CreateAnonymousWindow (Tcl_Interp * interp,
1496 Tk_Window parent, const char * screenName);
14971497 #endif
14981498 #ifndef Tk_SetClassProcs_TCL_DECLARED
14991499 #define Tk_SetClassProcs_TCL_DECLARED
15001500 /* 242 */
1501 EXTERN void Tk_SetClassProcs (Tk_Window tkwin,
1502 Tk_ClassProcs * procs,
1501 EXTERN void Tk_SetClassProcs (Tk_Window tkwin,
1502 Tk_ClassProcs * procs,
15031503 ClientData instanceData);
15041504 #endif
15051505 #ifndef Tk_SetInternalBorderEx_TCL_DECLARED
15061506 #define Tk_SetInternalBorderEx_TCL_DECLARED
15071507 /* 243 */
1508 EXTERN void Tk_SetInternalBorderEx (Tk_Window tkwin, int left,
1508 EXTERN void Tk_SetInternalBorderEx (Tk_Window tkwin, int left,
15091509 int right, int top, int bottom);
15101510 #endif
15111511 #ifndef Tk_SetMinimumRequestSize_TCL_DECLARED
15121512 #define Tk_SetMinimumRequestSize_TCL_DECLARED
15131513 /* 244 */
1514 EXTERN void Tk_SetMinimumRequestSize (Tk_Window tkwin,
1514 EXTERN void Tk_SetMinimumRequestSize (Tk_Window tkwin,
15151515 int minWidth, int minHeight);
15161516 #endif
15171517 #ifndef Tk_SetCaretPos_TCL_DECLARED
15181518 #define Tk_SetCaretPos_TCL_DECLARED
15191519 /* 245 */
1520 EXTERN void Tk_SetCaretPos (Tk_Window tkwin, int x, int y,
1520 EXTERN void Tk_SetCaretPos (Tk_Window tkwin, int x, int y,
15211521 int height);
15221522 #endif
15231523 #ifndef Tk_PhotoPutBlock_Panic_TCL_DECLARED
15241524 #define Tk_PhotoPutBlock_Panic_TCL_DECLARED
15251525 /* 246 */
1526 EXTERN void Tk_PhotoPutBlock_Panic (Tk_PhotoHandle handle,
1527 Tk_PhotoImageBlock * blockPtr, int x, int y,
1526 EXTERN void Tk_PhotoPutBlock_Panic (Tk_PhotoHandle handle,
1527 Tk_PhotoImageBlock * blockPtr, int x, int y,
15281528 int width, int height, int compRule);
15291529 #endif
15301530 #ifndef Tk_PhotoPutZoomedBlock_Panic_TCL_DECLARED
15311531 #define Tk_PhotoPutZoomedBlock_Panic_TCL_DECLARED
15321532 /* 247 */
1533 EXTERN void Tk_PhotoPutZoomedBlock_Panic (Tk_PhotoHandle handle,
1534 Tk_PhotoImageBlock * blockPtr, int x, int y,
1535 int width, int height, int zoomX, int zoomY,
1533 EXTERN void Tk_PhotoPutZoomedBlock_Panic (Tk_PhotoHandle handle,
1534 Tk_PhotoImageBlock * blockPtr, int x, int y,
1535 int width, int height, int zoomX, int zoomY,
15361536 int subsampleX, int subsampleY, int compRule);
15371537 #endif
15381538 #ifndef Tk_CollapseMotionEvents_TCL_DECLARED
15391539 #define Tk_CollapseMotionEvents_TCL_DECLARED
15401540 /* 248 */
1541 EXTERN int Tk_CollapseMotionEvents (Display * display,
1541 EXTERN int Tk_CollapseMotionEvents (Display * display,
15421542 int collapse);
15431543 #endif
15441544 #ifndef Tk_RegisterStyleEngine_TCL_DECLARED
15451545 #define Tk_RegisterStyleEngine_TCL_DECLARED
15461546 /* 249 */
1547 EXTERN Tk_StyleEngine Tk_RegisterStyleEngine (CONST char * name,
1547 EXTERN Tk_StyleEngine Tk_RegisterStyleEngine (const char * name,
15481548 Tk_StyleEngine parent);
15491549 #endif
15501550 #ifndef Tk_GetStyleEngine_TCL_DECLARED
15511551 #define Tk_GetStyleEngine_TCL_DECLARED
15521552 /* 250 */
1553 EXTERN Tk_StyleEngine Tk_GetStyleEngine (CONST char * name);
1553 EXTERN Tk_StyleEngine Tk_GetStyleEngine (const char * name);
15541554 #endif
15551555 #ifndef Tk_RegisterStyledElement_TCL_DECLARED
15561556 #define Tk_RegisterStyledElement_TCL_DECLARED
15571557 /* 251 */
1558 EXTERN int Tk_RegisterStyledElement (Tk_StyleEngine engine,
1558 EXTERN int Tk_RegisterStyledElement (Tk_StyleEngine engine,
15591559 Tk_ElementSpec * templatePtr);
15601560 #endif
15611561 #ifndef Tk_GetElementId_TCL_DECLARED
15621562 #define Tk_GetElementId_TCL_DECLARED
15631563 /* 252 */
1564 EXTERN int Tk_GetElementId (CONST char * name);
1564 EXTERN int Tk_GetElementId (const char * name);
15651565 #endif
15661566 #ifndef Tk_CreateStyle_TCL_DECLARED
15671567 #define Tk_CreateStyle_TCL_DECLARED
15681568 /* 253 */
1569 EXTERN Tk_Style Tk_CreateStyle (CONST char * name,
1569 EXTERN Tk_Style Tk_CreateStyle (const char * name,
15701570 Tk_StyleEngine engine, ClientData clientData);
15711571 #endif
15721572 #ifndef Tk_GetStyle_TCL_DECLARED
15731573 #define Tk_GetStyle_TCL_DECLARED
15741574 /* 254 */
1575 EXTERN Tk_Style Tk_GetStyle (Tcl_Interp * interp, CONST char * name);
1575 EXTERN Tk_Style Tk_GetStyle (Tcl_Interp * interp, const char * name);
15761576 #endif
15771577 #ifndef Tk_FreeStyle_TCL_DECLARED
15781578 #define Tk_FreeStyle_TCL_DECLARED
15821582 #ifndef Tk_NameOfStyle_TCL_DECLARED
15831583 #define Tk_NameOfStyle_TCL_DECLARED
15841584 /* 256 */
1585 EXTERN CONST char * Tk_NameOfStyle (Tk_Style style);
1585 EXTERN const char * Tk_NameOfStyle (Tk_Style style);
15861586 #endif
15871587 #ifndef Tk_AllocStyleFromObj_TCL_DECLARED
15881588 #define Tk_AllocStyleFromObj_TCL_DECLARED
15891589 /* 257 */
1590 EXTERN Tk_Style Tk_AllocStyleFromObj (Tcl_Interp * interp,
1590 EXTERN Tk_Style Tk_AllocStyleFromObj (Tcl_Interp * interp,
15911591 Tcl_Obj * objPtr);
15921592 #endif
15931593 #ifndef Tk_GetStyleFromObj_TCL_DECLARED
16031603 #ifndef Tk_GetStyledElement_TCL_DECLARED
16041604 #define Tk_GetStyledElement_TCL_DECLARED
16051605 /* 260 */
1606 EXTERN Tk_StyledElement Tk_GetStyledElement (Tk_Style style, int elementId,
1606 EXTERN Tk_StyledElement Tk_GetStyledElement (Tk_Style style, int elementId,
16071607 Tk_OptionTable optionTable);
16081608 #endif
16091609 #ifndef Tk_GetElementSize_TCL_DECLARED
16101610 #define Tk_GetElementSize_TCL_DECLARED
16111611 /* 261 */
1612 EXTERN void Tk_GetElementSize (Tk_Style style,
1613 Tk_StyledElement element, char * recordPtr,
1614 Tk_Window tkwin, int width, int height,
1612 EXTERN void Tk_GetElementSize (Tk_Style style,
1613 Tk_StyledElement element, char * recordPtr,
1614 Tk_Window tkwin, int width, int height,
16151615 int inner, int * widthPtr, int * heightPtr);
16161616 #endif
16171617 #ifndef Tk_GetElementBox_TCL_DECLARED
16181618 #define Tk_GetElementBox_TCL_DECLARED
16191619 /* 262 */
1620 EXTERN void Tk_GetElementBox (Tk_Style style,
1621 Tk_StyledElement element, char * recordPtr,
1622 Tk_Window tkwin, int x, int y, int width,
1623 int height, int inner, int * xPtr,
1620 EXTERN void Tk_GetElementBox (Tk_Style style,
1621 Tk_StyledElement element, char * recordPtr,
1622 Tk_Window tkwin, int x, int y, int width,
1623 int height, int inner, int * xPtr,
16241624 int * yPtr, int * widthPtr, int * heightPtr);
16251625 #endif
16261626 #ifndef Tk_GetElementBorderWidth_TCL_DECLARED
16271627 #define Tk_GetElementBorderWidth_TCL_DECLARED
16281628 /* 263 */
1629 EXTERN int Tk_GetElementBorderWidth (Tk_Style style,
1630 Tk_StyledElement element, char * recordPtr,
1629 EXTERN int Tk_GetElementBorderWidth (Tk_Style style,
1630 Tk_StyledElement element, char * recordPtr,
16311631 Tk_Window tkwin);
16321632 #endif
16331633 #ifndef Tk_DrawElement_TCL_DECLARED
16341634 #define Tk_DrawElement_TCL_DECLARED
16351635 /* 264 */
1636 EXTERN void Tk_DrawElement (Tk_Style style,
1637 Tk_StyledElement element, char * recordPtr,
1638 Tk_Window tkwin, Drawable d, int x, int y,
1636 EXTERN void Tk_DrawElement (Tk_Style style,
1637 Tk_StyledElement element, char * recordPtr,
1638 Tk_Window tkwin, Drawable d, int x, int y,
16391639 int width, int height, int state);
16401640 #endif
16411641 #ifndef Tk_PhotoExpand_TCL_DECLARED
16421642 #define Tk_PhotoExpand_TCL_DECLARED
16431643 /* 265 */
1644 EXTERN int Tk_PhotoExpand (Tcl_Interp * interp,
1644 EXTERN int Tk_PhotoExpand (Tcl_Interp * interp,
16451645 Tk_PhotoHandle handle, int width, int height);
16461646 #endif
16471647 #ifndef Tk_PhotoPutBlock_TCL_DECLARED
16481648 #define Tk_PhotoPutBlock_TCL_DECLARED
16491649 /* 266 */
1650 EXTERN int Tk_PhotoPutBlock (Tcl_Interp * interp,
1651 Tk_PhotoHandle handle,
1652 Tk_PhotoImageBlock * blockPtr, int x, int y,
1650 EXTERN int Tk_PhotoPutBlock (Tcl_Interp * interp,
1651 Tk_PhotoHandle handle,
1652 Tk_PhotoImageBlock * blockPtr, int x, int y,
16531653 int width, int height, int compRule);
16541654 #endif
16551655 #ifndef Tk_PhotoPutZoomedBlock_TCL_DECLARED
16561656 #define Tk_PhotoPutZoomedBlock_TCL_DECLARED
16571657 /* 267 */
1658 EXTERN int Tk_PhotoPutZoomedBlock (Tcl_Interp * interp,
1659 Tk_PhotoHandle handle,
1660 Tk_PhotoImageBlock * blockPtr, int x, int y,
1661 int width, int height, int zoomX, int zoomY,
1658 EXTERN int Tk_PhotoPutZoomedBlock (Tcl_Interp * interp,
1659 Tk_PhotoHandle handle,
1660 Tk_PhotoImageBlock * blockPtr, int x, int y,
1661 int width, int height, int zoomX, int zoomY,
16621662 int subsampleX, int subsampleY, int compRule);
16631663 #endif
16641664 #ifndef Tk_PhotoSetSize_TCL_DECLARED
16651665 #define Tk_PhotoSetSize_TCL_DECLARED
16661666 /* 268 */
1667 EXTERN int Tk_PhotoSetSize (Tcl_Interp * interp,
1667 EXTERN int Tk_PhotoSetSize (Tcl_Interp * interp,
16681668 Tk_PhotoHandle handle, int width, int height);
16691669 #endif
16701670 #ifndef Tk_GetUserInactiveTime_TCL_DECLARED
16851685 #ifndef Tk_CreateOldImageType_TCL_DECLARED
16861686 #define Tk_CreateOldImageType_TCL_DECLARED
16871687 /* 272 */
1688 EXTERN void Tk_CreateOldImageType (Tk_ImageType * typePtr);
1688 EXTERN void Tk_CreateOldImageType (const Tk_ImageType * typePtr);
16891689 #endif
16901690 #ifndef Tk_CreateOldPhotoImageFormat_TCL_DECLARED
16911691 #define Tk_CreateOldPhotoImageFormat_TCL_DECLARED
16921692 /* 273 */
16931693 EXTERN void Tk_CreateOldPhotoImageFormat (
1694 Tk_PhotoImageFormat * formatPtr);
1694 const Tk_PhotoImageFormat * formatPtr);
16951695 #endif
16961696
16971697 typedef struct TkStubHooks {
1698 CONST struct TkPlatStubs *tkPlatStubs;
1699 CONST struct TkIntStubs *tkIntStubs;
1700 CONST struct TkIntPlatStubs *tkIntPlatStubs;
1701 CONST struct TkIntXlibStubs *tkIntXlibStubs;
1698 const struct TkPlatStubs *tkPlatStubs;
1699 const struct TkIntStubs *tkIntStubs;
1700 const struct TkIntPlatStubs *tkIntPlatStubs;
1701 const struct TkIntXlibStubs *tkIntXlibStubs;
17021702 } TkStubHooks;
17031703
17041704 typedef struct TkStubs {
17051705 int magic;
1706 CONST struct TkStubHooks *hooks;
1706 const struct TkStubHooks *hooks;
17071707
17081708 void (*tk_MainLoop) (void); /* 0 */
17091709 XColor * (*tk_3DBorderColor) (Tk_3DBorder border); /* 1 */
17101710 GC (*tk_3DBorderGC) (Tk_Window tkwin, Tk_3DBorder border, int which); /* 2 */
17111711 void (*tk_3DHorizontalBevel) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftIn, int rightIn, int topBevel, int relief); /* 3 */
17121712 void (*tk_3DVerticalBevel) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftBevel, int relief); /* 4 */
1713 void (*tk_AddOption) (Tk_Window tkwin, CONST char * name, CONST char * value, int priority); /* 5 */
1713 void (*tk_AddOption) (Tk_Window tkwin, const char * name, const char * value, int priority); /* 5 */
17141714 void (*tk_BindEvent) (Tk_BindingTable bindingTable, XEvent * eventPtr, Tk_Window tkwin, int numObjects, ClientData * objectPtr); /* 6 */
17151715 void (*tk_CanvasDrawableCoords) (Tk_Canvas canvas, double x, double y, short * drawableXPtr, short * drawableYPtr); /* 7 */
17161716 void (*tk_CanvasEventuallyRedraw) (Tk_Canvas canvas, int x1, int y1, int x2, int y2); /* 8 */
1717 int (*tk_CanvasGetCoord) (Tcl_Interp * interp, Tk_Canvas canvas, CONST char * str, double * doublePtr); /* 9 */
1717 int (*tk_CanvasGetCoord) (Tcl_Interp * interp, Tk_Canvas canvas, const char * str, double * doublePtr); /* 9 */
17181718 Tk_CanvasTextInfo * (*tk_CanvasGetTextInfo) (Tk_Canvas canvas); /* 10 */
17191719 int (*tk_CanvasPsBitmap) (Tcl_Interp * interp, Tk_Canvas canvas, Pixmap bitmap, int x, int y, int width, int height); /* 11 */
17201720 int (*tk_CanvasPsColor) (Tcl_Interp * interp, Tk_Canvas canvas, XColor * colorPtr); /* 12 */
17231723 int (*tk_CanvasPsStipple) (Tcl_Interp * interp, Tk_Canvas canvas, Pixmap bitmap); /* 15 */
17241724 double (*tk_CanvasPsY) (Tk_Canvas canvas, double y); /* 16 */
17251725 void (*tk_CanvasSetStippleOrigin) (Tk_Canvas canvas, GC gc); /* 17 */
1726 int (*tk_CanvasTagsParseProc) (ClientData clientData, Tcl_Interp * interp, Tk_Window tkwin, CONST char * value, char * widgRec, int offset); /* 18 */
1727 char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char * widgRec, int offset, Tcl_FreeProc ** freeProcPtr); /* 19 */
1726 int (*tk_CanvasTagsParseProc) (ClientData clientData, Tcl_Interp * interp, Tk_Window tkwin, const char * value, char * widgRec, int offset); /* 18 */
1727 CONST86 char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char * widgRec, int offset, Tcl_FreeProc ** freeProcPtr); /* 19 */
17281728 Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */
17291729 void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short * screenXPtr, short * screenYPtr); /* 21 */
17301730 void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes * attsPtr); /* 22 */
17321732 void (*tk_ClearSelection) (Tk_Window tkwin, Atom selection); /* 24 */
17331733 int (*tk_ClipboardAppend) (Tcl_Interp * interp, Tk_Window tkwin, Atom target, Atom format, char* buffer); /* 25 */
17341734 int (*tk_ClipboardClear) (Tcl_Interp * interp, Tk_Window tkwin); /* 26 */
1735 int (*tk_ConfigureInfo) (Tcl_Interp * interp, Tk_Window tkwin, Tk_ConfigSpec * specs, char * widgRec, CONST char * argvName, int flags); /* 27 */
1736 int (*tk_ConfigureValue) (Tcl_Interp * interp, Tk_Window tkwin, Tk_ConfigSpec * specs, char * widgRec, CONST char * argvName, int flags); /* 28 */
1735 int (*tk_ConfigureInfo) (Tcl_Interp * interp, Tk_Window tkwin, Tk_ConfigSpec * specs, char * widgRec, const char * argvName, int flags); /* 27 */
1736 int (*tk_ConfigureValue) (Tcl_Interp * interp, Tk_Window tkwin, Tk_ConfigSpec * specs, char * widgRec, const char * argvName, int flags); /* 28 */
17371737 int (*tk_ConfigureWidget) (Tcl_Interp * interp, Tk_Window tkwin, Tk_ConfigSpec * specs, int argc, CONST84 char ** argv, char * widgRec, int flags); /* 29 */
17381738 void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges * valuePtr); /* 30 */
1739 Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, CONST char * str, int numChars, int wrapLength, Tk_Justify justify, int flags, int * widthPtr, int * heightPtr); /* 31 */
1739 Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char * str, int numChars, int wrapLength, Tk_Justify justify, int flags, int * widthPtr, int * heightPtr); /* 31 */
17401740 Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */
1741 unsigned long (*tk_CreateBinding) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, CONST char * eventStr, CONST char * command, int append); /* 33 */
1741 unsigned long (*tk_CreateBinding) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, const char * eventStr, const char * command, int append); /* 33 */
17421742 Tk_BindingTable (*tk_CreateBindingTable) (Tcl_Interp * interp); /* 34 */
17431743 Tk_ErrorHandler (*tk_CreateErrorHandler) (Display * display, int errNum, int request, int minorCode, Tk_ErrorProc * errorProc, ClientData clientData); /* 35 */
17441744 void (*tk_CreateEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc * proc, ClientData clientData); /* 36 */
17451745 void (*tk_CreateGenericHandler) (Tk_GenericProc * proc, ClientData clientData); /* 37 */
1746 void (*tk_CreateImageType) (Tk_ImageType * typePtr); /* 38 */
1746 void (*tk_CreateImageType) (const Tk_ImageType * typePtr); /* 38 */
17471747 void (*tk_CreateItemType) (Tk_ItemType * typePtr); /* 39 */
1748 void (*tk_CreatePhotoImageFormat) (Tk_PhotoImageFormat * formatPtr); /* 40 */
1748 void (*tk_CreatePhotoImageFormat) (const Tk_PhotoImageFormat * formatPtr); /* 40 */
17491749 void (*tk_CreateSelHandler) (Tk_Window tkwin, Atom selection, Atom target, Tk_SelectionProc * proc, ClientData clientData, Atom format); /* 41 */
1750 Tk_Window (*tk_CreateWindow) (Tcl_Interp * interp, Tk_Window parent, CONST char * name, CONST char * screenName); /* 42 */
1751 Tk_Window (*tk_CreateWindowFromPath) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * pathName, CONST char * screenName); /* 43 */
1752 int (*tk_DefineBitmap) (Tcl_Interp * interp, CONST char * name, CONST char * source, int width, int height); /* 44 */
1750 Tk_Window (*tk_CreateWindow) (Tcl_Interp * interp, Tk_Window parent, const char * name, const char * screenName); /* 42 */
1751 Tk_Window (*tk_CreateWindowFromPath) (Tcl_Interp * interp, Tk_Window tkwin, const char * pathName, const char * screenName); /* 43 */
1752 int (*tk_DefineBitmap) (Tcl_Interp * interp, const char * name, const char * source, int width, int height); /* 44 */
17531753 void (*tk_DefineCursor) (Tk_Window window, Tk_Cursor cursor); /* 45 */
17541754 void (*tk_DeleteAllBindings) (Tk_BindingTable bindingTable, ClientData object); /* 46 */
1755 int (*tk_DeleteBinding) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, CONST char * eventStr); /* 47 */
1755 int (*tk_DeleteBinding) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, const char * eventStr); /* 47 */
17561756 void (*tk_DeleteBindingTable) (Tk_BindingTable bindingTable); /* 48 */
17571757 void (*tk_DeleteErrorHandler) (Tk_ErrorHandler handler); /* 49 */
17581758 void (*tk_DeleteEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc * proc, ClientData clientData); /* 50 */
17591759 void (*tk_DeleteGenericHandler) (Tk_GenericProc * proc, ClientData clientData); /* 51 */
1760 void (*tk_DeleteImage) (Tcl_Interp * interp, CONST char * name); /* 52 */
1760 void (*tk_DeleteImage) (Tcl_Interp * interp, const char * name); /* 52 */
17611761 void (*tk_DeleteSelHandler) (Tk_Window tkwin, Atom selection, Atom target); /* 53 */
17621762 void (*tk_DestroyWindow) (Tk_Window tkwin); /* 54 */
17631763 CONST84_RETURN char * (*tk_DisplayName) (Tk_Window tkwin); /* 55 */
17641764 int (*tk_DistanceToTextLayout) (Tk_TextLayout layout, int x, int y); /* 56 */
17651765 void (*tk_Draw3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint * pointPtr, int numPoints, int borderWidth, int leftRelief); /* 57 */
17661766 void (*tk_Draw3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 58 */
1767 void (*tk_DrawChars) (Display * display, Drawable drawable, GC gc, Tk_Font tkfont, CONST char * source, int numBytes, int x, int y); /* 59 */
1767 void (*tk_DrawChars) (Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char * source, int numBytes, int x, int y); /* 59 */
17681768 void (*tk_DrawFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable); /* 60 */
17691769 void (*tk_DrawTextLayout) (Display * display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int firstChar, int lastChar); /* 61 */
17701770 void (*tk_Fill3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint * pointPtr, int numPoints, int borderWidth, int leftRelief); /* 62 */
17711771 void (*tk_Fill3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 63 */
1772 Tk_PhotoHandle (*tk_FindPhoto) (Tcl_Interp * interp, CONST char * imageName); /* 64 */
1772 Tk_PhotoHandle (*tk_FindPhoto) (Tcl_Interp * interp, const char * imageName); /* 64 */
17731773 Font (*tk_FontId) (Tk_Font font); /* 65 */
17741774 void (*tk_Free3DBorder) (Tk_3DBorder border); /* 66 */
17751775 void (*tk_FreeBitmap) (Display * display, Pixmap bitmap); /* 67 */
17871787 void (*tk_GeometryRequest) (Tk_Window tkwin, int reqWidth, int reqHeight); /* 79 */
17881788 Tk_3DBorder (*tk_Get3DBorder) (Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid colorName); /* 80 */
17891789 void (*tk_GetAllBindings) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object); /* 81 */
1790 int (*tk_GetAnchor) (Tcl_Interp * interp, CONST char * str, Tk_Anchor * anchorPtr); /* 82 */
1790 int (*tk_GetAnchor) (Tcl_Interp * interp, const char * str, Tk_Anchor * anchorPtr); /* 82 */
17911791 CONST84_RETURN char * (*tk_GetAtomName) (Tk_Window tkwin, Atom atom); /* 83 */
1792 CONST84_RETURN char * (*tk_GetBinding) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, CONST char * eventStr); /* 84 */
1793 Pixmap (*tk_GetBitmap) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * str); /* 85 */
1794 Pixmap (*tk_GetBitmapFromData) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * source, int width, int height); /* 86 */
1795 int (*tk_GetCapStyle) (Tcl_Interp * interp, CONST char * str, int * capPtr); /* 87 */
1792 CONST84_RETURN char * (*tk_GetBinding) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, const char * eventStr); /* 84 */
1793 Pixmap (*tk_GetBitmap) (Tcl_Interp * interp, Tk_Window tkwin, const char * str); /* 85 */
1794 Pixmap (*tk_GetBitmapFromData) (Tcl_Interp * interp, Tk_Window tkwin, const char * source, int width, int height); /* 86 */
1795 int (*tk_GetCapStyle) (Tcl_Interp * interp, const char * str, int * capPtr); /* 87 */
17961796 XColor * (*tk_GetColor) (Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid name); /* 88 */
17971797 XColor * (*tk_GetColorByValue) (Tk_Window tkwin, XColor * colorPtr); /* 89 */
1798 Colormap (*tk_GetColormap) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * str); /* 90 */
1798 Colormap (*tk_GetColormap) (Tcl_Interp * interp, Tk_Window tkwin, const char * str); /* 90 */
17991799 Tk_Cursor (*tk_GetCursor) (Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid str); /* 91 */
1800 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 */
1801 Tk_Font (*tk_GetFont) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * str); /* 93 */
1800 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 */
1801 Tk_Font (*tk_GetFont) (Tcl_Interp * interp, Tk_Window tkwin, const char * str); /* 93 */
18021802 Tk_Font (*tk_GetFontFromObj) (Tk_Window tkwin, Tcl_Obj * objPtr); /* 94 */
18031803 void (*tk_GetFontMetrics) (Tk_Font font, Tk_FontMetrics * fmPtr); /* 95 */
18041804 GC (*tk_GetGC) (Tk_Window tkwin, unsigned long valueMask, XGCValues * valuePtr); /* 96 */
1805 Tk_Image (*tk_GetImage) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * name, Tk_ImageChangedProc * changeProc, ClientData clientData); /* 97 */
1806 ClientData (*tk_GetImageMasterData) (Tcl_Interp * interp, CONST char * name, Tk_ImageType ** typePtrPtr); /* 98 */
1805 Tk_Image (*tk_GetImage) (Tcl_Interp * interp, Tk_Window tkwin, const char * name, Tk_ImageChangedProc * changeProc, ClientData clientData); /* 97 */
1806 ClientData (*tk_GetImageMasterData) (Tcl_Interp * interp, const char * name, CONST86 Tk_ImageType ** typePtrPtr); /* 98 */
18071807 Tk_ItemType * (*tk_GetItemTypes) (void); /* 99 */
1808 int (*tk_GetJoinStyle) (Tcl_Interp * interp, CONST char * str, int * joinPtr); /* 100 */
1809 int (*tk_GetJustify) (Tcl_Interp * interp, CONST char * str, Tk_Justify * justifyPtr); /* 101 */
1808 int (*tk_GetJoinStyle) (Tcl_Interp * interp, const char * str, int * joinPtr); /* 100 */
1809 int (*tk_GetJustify) (Tcl_Interp * interp, const char * str, Tk_Justify * justifyPtr); /* 101 */
18101810 int (*tk_GetNumMainWindows) (void); /* 102 */
1811 Tk_Uid (*tk_GetOption) (Tk_Window tkwin, CONST char * name, CONST char * className); /* 103 */
1812 int (*tk_GetPixels) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * str, int * intPtr); /* 104 */
1811 Tk_Uid (*tk_GetOption) (Tk_Window tkwin, const char * name, const char * className); /* 103 */
1812 int (*tk_GetPixels) (Tcl_Interp * interp, Tk_Window tkwin, const char * str, int * intPtr); /* 104 */
18131813 Pixmap (*tk_GetPixmap) (Display * display, Drawable d, int width, int height, int depth); /* 105 */
1814 int (*tk_GetRelief) (Tcl_Interp * interp, CONST char * name, int * reliefPtr); /* 106 */
1814 int (*tk_GetRelief) (Tcl_Interp * interp, const char * name, int * reliefPtr); /* 106 */
18151815 void (*tk_GetRootCoords) (Tk_Window tkwin, int * xPtr, int * yPtr); /* 107 */
18161816 int (*tk_GetScrollInfo) (Tcl_Interp * interp, int argc, CONST84 char ** argv, double * dblPtr, int * intPtr); /* 108 */
1817 int (*tk_GetScreenMM) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * str, double * doublePtr); /* 109 */
1817 int (*tk_GetScreenMM) (Tcl_Interp * interp, Tk_Window tkwin, const char * str, double * doublePtr); /* 109 */
18181818 int (*tk_GetSelection) (Tcl_Interp * interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc * proc, ClientData clientData); /* 110 */
1819 Tk_Uid (*tk_GetUid) (CONST char * str); /* 111 */
1820 Visual * (*tk_GetVisual) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * str, int * depthPtr, Colormap * colormapPtr); /* 112 */
1819 Tk_Uid (*tk_GetUid) (const char * str); /* 111 */
1820 Visual * (*tk_GetVisual) (Tcl_Interp * interp, Tk_Window tkwin, const char * str, int * depthPtr, Colormap * colormapPtr); /* 112 */
18211821 void (*tk_GetVRootGeometry) (Tk_Window tkwin, int * xPtr, int * yPtr, int * widthPtr, int * heightPtr); /* 113 */
18221822 int (*tk_Grab) (Tcl_Interp * interp, Tk_Window tkwin, int grabGlobal); /* 114 */
18231823 void (*tk_HandleEvent) (XEvent * eventPtr); /* 115 */
18241824 Tk_Window (*tk_IdToWindow) (Display * display, Window window); /* 116 */
18251825 void (*tk_ImageChanged) (Tk_ImageMaster master, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */
18261826 int (*tk_Init) (Tcl_Interp * interp); /* 118 */
1827 Atom (*tk_InternAtom) (Tk_Window tkwin, CONST char * name); /* 119 */
1827 Atom (*tk_InternAtom) (Tk_Window tkwin, const char * name); /* 119 */
18281828 int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */
18291829 void (*tk_MaintainGeometry) (Tk_Window slave, Tk_Window master, int x, int y, int width, int height); /* 121 */
18301830 Tk_Window (*tk_MainWindow) (Tcl_Interp * interp); /* 122 */
18311831 void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */
1832 void (*tk_ManageGeometry) (Tk_Window tkwin, CONST Tk_GeomMgr * mgrPtr, ClientData clientData); /* 124 */
1832 void (*tk_ManageGeometry) (Tk_Window tkwin, const Tk_GeomMgr * mgrPtr, ClientData clientData); /* 124 */
18331833 void (*tk_MapWindow) (Tk_Window tkwin); /* 125 */
1834 int (*tk_MeasureChars) (Tk_Font tkfont, CONST char * source, int numBytes, int maxPixels, int flags, int * lengthPtr); /* 126 */
1834 int (*tk_MeasureChars) (Tk_Font tkfont, const char * source, int numBytes, int maxPixels, int flags, int * lengthPtr); /* 126 */
18351835 void (*tk_MoveResizeWindow) (Tk_Window tkwin, int x, int y, int width, int height); /* 127 */
18361836 void (*tk_MoveWindow) (Tk_Window tkwin, int x, int y); /* 128 */
18371837 void (*tk_MoveToplevelWindow) (Tk_Window tkwin, int x, int y); /* 129 */
18461846 CONST84_RETURN char * (*tk_NameOfJoinStyle) (int join); /* 138 */
18471847 CONST84_RETURN char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */
18481848 CONST84_RETURN char * (*tk_NameOfRelief) (int relief); /* 140 */
1849 Tk_Window (*tk_NameToWindow) (Tcl_Interp * interp, CONST char * pathName, Tk_Window tkwin); /* 141 */
1849 Tk_Window (*tk_NameToWindow) (Tcl_Interp * interp, const char * pathName, Tk_Window tkwin); /* 141 */
18501850 void (*tk_OwnSelection) (Tk_Window tkwin, Atom selection, Tk_LostSelProc * proc, ClientData clientData); /* 142 */
1851 int (*tk_ParseArgv) (Tcl_Interp * interp, Tk_Window tkwin, int * argcPtr, CONST84 char ** argv, Tk_ArgvInfo * argTable, int flags); /* 143 */
1851 int (*tk_ParseArgv) (Tcl_Interp * interp, Tk_Window tkwin, int * argcPtr, CONST84 char ** argv, const Tk_ArgvInfo * argTable, int flags); /* 143 */
18521852 void (*tk_PhotoPutBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height); /* 144 */
18531853 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 */
18541854 int (*tk_PhotoGetImage) (Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr); /* 146 */
18651865 int (*tk_RestackWindow) (Tk_Window tkwin, int aboveBelow, Tk_Window other); /* 157 */
18661866 Tk_RestrictProc * (*tk_RestrictEvents) (Tk_RestrictProc * proc, ClientData arg, ClientData * prevArgPtr); /* 158 */
18671867 int (*tk_SafeInit) (Tcl_Interp * interp); /* 159 */
1868 CONST char * (*tk_SetAppName) (Tk_Window tkwin, CONST char * name); /* 160 */
1868 const char * (*tk_SetAppName) (Tk_Window tkwin, const char * name); /* 160 */
18691869 void (*tk_SetBackgroundFromBorder) (Tk_Window tkwin, Tk_3DBorder border); /* 161 */
1870 void (*tk_SetClass) (Tk_Window tkwin, CONST char * className); /* 162 */
1870 void (*tk_SetClass) (Tk_Window tkwin, const char * className); /* 162 */
18711871 void (*tk_SetGrid) (Tk_Window tkwin, int reqWidth, int reqHeight, int gridWidth, int gridHeight); /* 163 */
18721872 void (*tk_SetInternalBorder) (Tk_Window tkwin, int width); /* 164 */
18731873 void (*tk_SetWindowBackground) (Tk_Window tkwin, unsigned long pixel); /* 165 */
18811881 void (*tk_SizeOfImage) (Tk_Image image, int * widthPtr, int * heightPtr); /* 173 */
18821882 int (*tk_StrictMotif) (Tk_Window tkwin); /* 174 */
18831883 void (*tk_TextLayoutToPostscript) (Tcl_Interp * interp, Tk_TextLayout layout); /* 175 */
1884 int (*tk_TextWidth) (Tk_Font font, CONST char * str, int numBytes); /* 176 */
1884 int (*tk_TextWidth) (Tk_Font font, const char * str, int numBytes); /* 176 */
18851885 void (*tk_UndefineCursor) (Tk_Window window); /* 177 */
1886 void (*tk_UnderlineChars) (Display * display, Drawable drawable, GC gc, Tk_Font tkfont, CONST char * source, int x, int y, int firstByte, int lastByte); /* 178 */
1886 void (*tk_UnderlineChars) (Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char * source, int x, int y, int firstByte, int lastByte); /* 178 */
18871887 void (*tk_UnderlineTextLayout) (Display * display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline); /* 179 */
18881888 void (*tk_Ungrab) (Tk_Window tkwin); /* 180 */
18891889 void (*tk_UnmaintainGeometry) (Tk_Window slave, Tk_Window master); /* 181 */
18951895 XColor * (*tk_AllocColorFromObj) (Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr); /* 187 */
18961896 Tk_Cursor (*tk_AllocCursorFromObj) (Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr); /* 188 */
18971897 Tk_Font (*tk_AllocFontFromObj) (Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr); /* 189 */
1898 Tk_OptionTable (*tk_CreateOptionTable) (Tcl_Interp * interp, CONST Tk_OptionSpec * templatePtr); /* 190 */
1898 Tk_OptionTable (*tk_CreateOptionTable) (Tcl_Interp * interp, const Tk_OptionSpec * templatePtr); /* 190 */
18991899 void (*tk_DeleteOptionTable) (Tk_OptionTable optionTable); /* 191 */
19001900 void (*tk_Free3DBorderFromObj) (Tk_Window tkwin, Tcl_Obj * objPtr); /* 192 */
19011901 void (*tk_FreeBitmapFromObj) (Tk_Window tkwin, Tcl_Obj * objPtr); /* 193 */
19151915 int (*tk_GetMMFromObj) (Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr, double * doublePtr); /* 207 */
19161916 int (*tk_GetPixelsFromObj) (Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr, int * intPtr); /* 208 */
19171917 int (*tk_GetReliefFromObj) (Tcl_Interp * interp, Tcl_Obj * objPtr, int * resultPtr); /* 209 */
1918 int (*tk_GetScrollInfoObj) (Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], double * dblPtr, int * intPtr); /* 210 */
1918 int (*tk_GetScrollInfoObj) (Tcl_Interp * interp, int objc, Tcl_Obj *const objv[], double * dblPtr, int * intPtr); /* 210 */
19191919 int (*tk_InitOptions) (Tcl_Interp * interp, char * recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */
19201920 void (*tk_MainEx) (int argc, char ** argv, Tcl_AppInitProc * appInitProc, Tcl_Interp * interp); /* 212 */
19211921 void (*tk_RestoreSavedOptions) (Tk_SavedOptions * savePtr); /* 213 */
1922 int (*tk_SetOptions) (Tcl_Interp * interp, char * recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *CONST objv[], Tk_Window tkwin, Tk_SavedOptions * savePtr, int * maskPtr); /* 214 */
1922 int (*tk_SetOptions) (Tcl_Interp * interp, char * recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions * savePtr, int * maskPtr); /* 214 */
19231923 void (*tk_InitConsoleChannels) (Tcl_Interp * interp); /* 215 */
19241924 int (*tk_CreateConsoleWindow) (Tcl_Interp * interp); /* 216 */
1925 void (*tk_CreateSmoothMethod) (Tcl_Interp * interp, Tk_SmoothMethod * method); /* 217 */
1925 void (*tk_CreateSmoothMethod) (Tcl_Interp * interp, const Tk_SmoothMethod * method); /* 217 */
19261926 void *reserved218;
19271927 void *reserved219;
1928 int (*tk_GetDash) (Tcl_Interp * interp, CONST char * value, Tk_Dash * dash); /* 220 */
1928 int (*tk_GetDash) (Tcl_Interp * interp, const char * value, Tk_Dash * dash); /* 220 */
19291929 void (*tk_CreateOutline) (Tk_Outline * outline); /* 221 */
19301930 void (*tk_DeleteOutline) (Display * display, Tk_Outline * outline); /* 222 */
19311931 int (*tk_ConfigOutlineGC) (XGCValues * gcValues, Tk_Canvas canvas, Tk_Item * item, Tk_Outline * outline); /* 223 */
19461946 int (*tk_PostscriptPhoto) (Tcl_Interp * interp, Tk_PhotoImageBlock * blockPtr, Tk_PostscriptInfo psInfo, int width, int height); /* 238 */
19471947 void (*tk_CreateClientMessageHandler) (Tk_ClientMessageProc * proc); /* 239 */
19481948 void (*tk_DeleteClientMessageHandler) (Tk_ClientMessageProc * proc); /* 240 */
1949 Tk_Window (*tk_CreateAnonymousWindow) (Tcl_Interp * interp, Tk_Window parent, CONST char * screenName); /* 241 */
1949 Tk_Window (*tk_CreateAnonymousWindow) (Tcl_Interp * interp, Tk_Window parent, const char * screenName); /* 241 */
19501950 void (*tk_SetClassProcs) (Tk_Window tkwin, Tk_ClassProcs * procs, ClientData instanceData); /* 242 */
19511951 void (*tk_SetInternalBorderEx) (Tk_Window tkwin, int left, int right, int top, int bottom); /* 243 */
19521952 void (*tk_SetMinimumRequestSize) (Tk_Window tkwin, int minWidth, int minHeight); /* 244 */
19541954 void (*tk_PhotoPutBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock * blockPtr, int x, int y, int width, int height, int compRule); /* 246 */
19551955 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 */
19561956 int (*tk_CollapseMotionEvents) (Display * display, int collapse); /* 248 */
1957 Tk_StyleEngine (*tk_RegisterStyleEngine) (CONST char * name, Tk_StyleEngine parent); /* 249 */
1958 Tk_StyleEngine (*tk_GetStyleEngine) (CONST char * name); /* 250 */
1957 Tk_StyleEngine (*tk_RegisterStyleEngine) (const char * name, Tk_StyleEngine parent); /* 249 */
1958 Tk_StyleEngine (*tk_GetStyleEngine) (const char * name); /* 250 */
19591959 int (*tk_RegisterStyledElement) (Tk_StyleEngine engine, Tk_ElementSpec * templatePtr); /* 251 */
1960 int (*tk_GetElementId) (CONST char * name); /* 252 */
1961 Tk_Style (*tk_CreateStyle) (CONST char * name, Tk_StyleEngine engine, ClientData clientData); /* 253 */
1962 Tk_Style (*tk_GetStyle) (Tcl_Interp * interp, CONST char * name); /* 254 */
1960 int (*tk_GetElementId) (const char * name); /* 252 */
1961 Tk_Style (*tk_CreateStyle) (const char * name, Tk_StyleEngine engine, ClientData clientData); /* 253 */
1962 Tk_Style (*tk_GetStyle) (Tcl_Interp * interp, const char * name); /* 254 */
19631963 void (*tk_FreeStyle) (Tk_Style style); /* 255 */
1964 CONST char * (*tk_NameOfStyle) (Tk_Style style); /* 256 */
1964 const char * (*tk_NameOfStyle) (Tk_Style style); /* 256 */
19651965 Tk_Style (*tk_AllocStyleFromObj) (Tcl_Interp * interp, Tcl_Obj * objPtr); /* 257 */
19661966 Tk_Style (*tk_GetStyleFromObj) (Tcl_Obj * objPtr); /* 258 */
19671967 void (*tk_FreeStyleFromObj) (Tcl_Obj * objPtr); /* 259 */
19771977 long (*tk_GetUserInactiveTime) (Display * dpy); /* 269 */
19781978 void (*tk_ResetUserInactiveTime) (Display * dpy); /* 270 */
19791979 Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */
1980 void (*tk_CreateOldImageType) (Tk_ImageType * typePtr); /* 272 */
1981 void (*tk_CreateOldPhotoImageFormat) (Tk_PhotoImageFormat * formatPtr); /* 273 */
1980 void (*tk_CreateOldImageType) (const Tk_ImageType * typePtr); /* 272 */
1981 void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat * formatPtr); /* 273 */
19821982 } TkStubs;
19831983
19841984 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
1985 extern CONST TkStubs *tkStubsPtr;
1985 extern const TkStubs *tkStubsPtr;
19861986 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
19871987
19881988 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
1313 * See the file "license.terms" for information on usage and redistribution of
1414 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1515 *
16 * RCS: @(#) $Id: tkEntry.c,v 1.52 2008/10/09 21:49:44 dkf Exp $
16 * RCS: @(#) $Id: tkEntry.c,v 1.57 2008/12/09 21:22:56 dgp Exp $
1717 */
1818
1919 #include "tkInt.h"
3636 #define DOUBLES_EQ(d1, d2) (fabs((d1) - (d2)) < MIN_DBL_VAL)
3737
3838
39 static char *stateStrings[] = {
39 static const char *const stateStrings[] = {
4040 "disabled", "normal", "readonly", NULL
4141 };
4242
4444 * Definitions for -validate option values:
4545 */
4646
47 static char *validateStrings[] = {
47 static const char *const validateStrings[] = {
4848 "all", "key", "focus", "focusin", "focusout", "none", NULL
4949 };
5050 enum validateType {
318318 * dispatch the entry widget command.
319319 */
320320
321 static const char *entryCmdNames[] = {
321 static const char *const entryCmdNames[] = {
322322 "bbox", "cget", "configure", "delete", "get", "icursor", "index",
323323 "insert", "scan", "selection", "validate", "xview", NULL
324324 };
329329 COMMAND_SCAN, COMMAND_SELECTION, COMMAND_VALIDATE, COMMAND_XVIEW
330330 };
331331
332 static const char *selCmdNames[] = {
332 static const char *const selCmdNames[] = {
333333 "adjust", "clear", "from", "present", "range", "to", NULL
334334 };
335335
344344 * dispatch the spinbox widget command.
345345 */
346346
347 static const char *sbCmdNames[] = {
347 static const char *const sbCmdNames[] = {
348348 "bbox", "cget", "configure", "delete", "get", "icursor", "identify",
349349 "index", "insert", "invoke", "scan", "selection", "set",
350350 "validate", "xview", NULL
357357 SB_CMD_SET, SB_CMD_VALIDATE, SB_CMD_XVIEW
358358 };
359359
360 static const char *sbSelCmdNames[] = {
360 static const char *const sbSelCmdNames[] = {
361361 "adjust", "clear", "element", "from", "present", "range", "to", NULL
362362 };
363363
375375 * modify them, you must modify the strings here.
376376 */
377377
378 static const char *selElementNames[] = {
378 static const char *const selElementNames[] = {
379379 "none", "buttondown", "buttonup", NULL, "entry"
380380 };
381381
558558 return TCL_ERROR;
559559 }
560560
561 Tcl_SetResult(interp, Tk_PathName(entryPtr->tkwin), TCL_STATIC);
561 Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin));
562562 return TCL_OK;
563563 }
564564
611611 switch ((enum entryCmd) cmdIndex) {
612612 case COMMAND_BBOX: {
613613 int index, x, y, width, height;
614 char buf[TCL_INTEGER_SPACE * 4];
615614
616615 if (objc != 3) {
617616 Tcl_WrongNumArgs(interp, 2, objv, "index");
625624 index--;
626625 }
627626 Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height);
628 sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX,
629 y + entryPtr->layoutY, width, height);
630 Tcl_SetResult(interp, buf, TCL_VOLATILE);
627 Tcl_SetObjResult(interp, Tcl_ObjPrintf("%d %d %d %d",
628 x + entryPtr->layoutX, y + entryPtr->layoutY, width, height));
631629 break;
632630 }
633631
641639 entryPtr->optionTable, objv[2], entryPtr->tkwin);
642640 if (objPtr == NULL) {
643641 goto error;
644 } else {
645 Tcl_SetObjResult(interp, objPtr);
646 }
642 }
643 Tcl_SetObjResult(interp, objPtr);
647644 break;
648645
649646 case COMMAND_CONFIGURE:
654651 entryPtr->tkwin);
655652 if (objPtr == NULL) {
656653 goto error;
657 } else {
658 Tcl_SetObjResult(interp, objPtr);
659 }
654 }
655 Tcl_SetObjResult(interp, objPtr);
660656 } else {
661657 result = ConfigureEntry(interp, entryPtr, objc-2, objv+2, 0);
662658 }
13341330 code = Tcl_GetDouble(NULL, entryPtr->string, &dvalue);
13351331 if (code != TCL_OK) {
13361332 dvalue = sbPtr->fromValue;
1337 } else {
1338 if (dvalue > sbPtr->toValue) {
1339 dvalue = sbPtr->toValue;
1340 } else if (dvalue < sbPtr->fromValue) {
1341 dvalue = sbPtr->fromValue;
1342 }
1333 } else if (dvalue > sbPtr->toValue) {
1334 dvalue = sbPtr->toValue;
1335 } else if (dvalue < sbPtr->fromValue) {
1336 dvalue = sbPtr->fromValue;
13431337 }
13441338 sprintf(sbPtr->formatBuf, sbPtr->valueFormat, dvalue);
13451339 EntryValueChanged(entryPtr, sbPtr->formatBuf);
19671961 height = fm.linespace + 2*entryPtr->inset + 2*(YPAD-XPAD);
19681962 if (entryPtr->prefWidth > 0) {
19691963 width = entryPtr->prefWidth*entryPtr->avgWidth + 2*entryPtr->inset;
1964 } else if (totalLength == 0) {
1965 width = entryPtr->avgWidth + 2*entryPtr->inset;
19701966 } else {
1971 if (totalLength == 0) {
1972 width = entryPtr->avgWidth + 2*entryPtr->inset;
1973 } else {
1974 width = totalLength + 2*entryPtr->inset;
1975 }
1967 width = totalLength + 2*entryPtr->inset;
19761968 }
19771969
19781970 /*
25142506
25152507 length = strlen(string);
25162508
2517 if (string[0] == 'a') {
2518 if (strncmp(string, "anchor", length) == 0) {
2519 *indexPtr = entryPtr->selectAnchor;
2520 } else {
2521 badIndex:
2522
2523 /*
2524 * Some of the paths here leave messages in the interp's result,
2525 * so we have to clear it out before storing our own message.
2526 */
2527
2528 Tcl_SetResult(interp, NULL, TCL_STATIC);
2529 Tcl_AppendResult(interp, "bad ",
2530 (entryPtr->type == TK_ENTRY) ? "entry" : "spinbox",
2531 " index \"", string, "\"", NULL);
2532 return TCL_ERROR;
2533 }
2534 } else if (string[0] == 'e') {
2535 if (strncmp(string, "end", length) == 0) {
2536 *indexPtr = entryPtr->numChars;
2537 } else {
2509 switch (string[0]) {
2510 case 'a':
2511 if (strncmp(string, "anchor", length) != 0) {
25382512 goto badIndex;
25392513 }
2540 } else if (string[0] == 'i') {
2541 if (strncmp(string, "insert", length) == 0) {
2542 *indexPtr = entryPtr->insertPos;
2543 } else {
2514 *indexPtr = entryPtr->selectAnchor;
2515 break;
2516 case 'e':
2517 if (strncmp(string, "end", length) != 0) {
25442518 goto badIndex;
25452519 }
2546 } else if (string[0] == 's') {
2520 *indexPtr = entryPtr->numChars;
2521 break;
2522 case 'i':
2523 if (strncmp(string, "insert", length) != 0) {
2524 goto badIndex;
2525 }
2526 *indexPtr = entryPtr->insertPos;
2527 break;
2528 case 's':
25472529 if (entryPtr->selectFirst < 0) {
2548 Tcl_SetResult(interp, NULL, TCL_STATIC);
2530 Tcl_ResetResult(interp);
25492531 Tcl_AppendResult(interp, "selection isn't in widget ",
25502532 Tk_PathName(entryPtr->tkwin), NULL);
25512533 return TCL_ERROR;
25602542 } else {
25612543 goto badIndex;
25622544 }
2563 } else if (string[0] == '@') {
2545 break;
2546 case '@': {
25642547 int x, roundUp, maxWidth;
25652548
25662549 if (Tcl_GetInt(interp, string + 1, &x) != TCL_OK) {
25712554 }
25722555 roundUp = 0;
25732556 maxWidth = Tk_Width(entryPtr->tkwin) - entryPtr->inset
2574 - entryPtr->xWidth - 1;
2557 - entryPtr->xWidth - 1;
25752558 if (x > maxWidth) {
25762559 x = maxWidth;
25772560 roundUp = 1;
25892572 if (roundUp && (*indexPtr < entryPtr->numChars)) {
25902573 *indexPtr += 1;
25912574 }
2592 } else {
2575 break;
2576 }
2577 default:
25932578 if (Tcl_GetInt(interp, string, indexPtr) != TCL_OK) {
25942579 goto badIndex;
25952580 }
26002585 }
26012586 }
26022587 return TCL_OK;
2588
2589 badIndex:
2590 Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad %s index \"%s\"",
2591 (entryPtr->type == TK_ENTRY) ? "entry" : "spinbox", string));
2592 return TCL_ERROR;
26032593 }
26042594
26052595 /*
29492939 "\n (horizontal scrolling command executed by ");
29502940 Tcl_AddErrorInfo(interp, Tk_PathName(entryPtr->tkwin));
29512941 Tcl_AddErrorInfo(interp, ")");
2952 Tcl_BackgroundError(interp);
2953 }
2954 Tcl_SetResult(interp, NULL, TCL_STATIC);
2942 Tcl_BackgroundException(interp, code);
2943 }
2944 Tcl_ResetResult(interp);
29552945 Tcl_Release(interp);
29562946 }
29572947
31503140 */
31513141
31523142 if (code != TCL_OK && code != TCL_RETURN) {
3153 Tcl_AddErrorInfo(interp, "\n\t(in validation command executed by ");
3154 Tcl_AddErrorInfo(interp, Tk_PathName(entryPtr->tkwin));
3155 Tcl_AddErrorInfo(interp, ")");
3156 Tcl_BackgroundError(interp);
3143 Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
3144 "\n\t(in validation command executed by %s)",
3145 Tk_PathName(entryPtr->tkwin)));
3146 Tcl_BackgroundException(interp, code);
31573147 return TCL_ERROR;
31583148 }
31593149
31663156 Tcl_AddErrorInfo(interp,
31673157 "\nvalid boolean not returned by validation command");
31683158 Tcl_BackgroundError(interp);
3169 Tcl_SetResult(interp, NULL, 0);
3159 Tcl_ResetResult(interp);
31703160 return TCL_ERROR;
31713161 }
31723162
3173 Tcl_SetResult(interp, NULL, 0);
3163 Tcl_ResetResult(interp);
31743164 return (bool ? TCL_OK : TCL_BREAK);
31753165 }
31763166
32843274 change, newValue, index, type, &script);
32853275 Tcl_DStringAppend(&script, "", 1);
32863276 p = Tcl_DStringValue(&script);
3287 if (Tcl_EvalEx(entryPtr->interp, p, -1,
3288 TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT) != TCL_OK) {
3277 code = Tcl_EvalEx(entryPtr->interp, p, -1,
3278 TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
3279 if (code != TCL_OK) {
32893280 Tcl_AddErrorInfo(entryPtr->interp,
32903281 "\n\t(in invalidcommand executed by entry)");
3291 Tcl_BackgroundError(entryPtr->interp);
3282 Tcl_BackgroundException(entryPtr->interp, code);
32923283 code = TCL_ERROR;
32933284 entryPtr->validate = VALIDATE_NONE;
32943285 }
36573648 switch ((enum sbCmd) cmdIndex) {
36583649 case SB_CMD_BBOX: {
36593650 int index, x, y, width, height;
3660 char buf[TCL_INTEGER_SPACE * 4];
36613651
36623652 if (objc != 3) {
36633653 Tcl_WrongNumArgs(interp, 2, objv, "index");
36713661 index--;
36723662 }
36733663 Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height);
3674 sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX,
3675 y + entryPtr->layoutY, width, height);
3676 Tcl_SetResult(interp, buf, TCL_VOLATILE);
3664 Tcl_SetObjResult(interp, Tcl_ObjPrintf("%d %d %d %d",
3665 x + entryPtr->layoutX, y + entryPtr->layoutY, width, height));
36773666 break;
36783667 }
36793668
36873676 entryPtr->optionTable, objv[2], entryPtr->tkwin);
36883677 if (objPtr == NULL) {
36893678 goto error;
3690 } else {
3691 Tcl_SetObjResult(interp, objPtr);
3692 }
3679 }
3680 Tcl_SetObjResult(interp, objPtr);
36933681 break;
36943682
36953683 case SB_CMD_CONFIGURE:
36993687 entryPtr->tkwin);
37003688 if (objPtr == NULL) {
37013689 goto error;
3702 } else {
3703 Tcl_SetObjResult(interp, objPtr);
3704 }
3690 }
3691 Tcl_SetObjResult(interp, objPtr);
37053692 } else {
37063693 result = ConfigureEntry(interp, entryPtr, objc-2, objv+2, 0);
37073694 }
41714158 * "down" button. */
41724159 {
41734160 Entry *entryPtr = (Entry *) sbPtr;
4174 char *type;
4161 const char *type;
41754162 int code, up;
41764163 Tcl_DString script;
41774164
42964283
42974284 if (code != TCL_OK) {
42984285 Tcl_AddErrorInfo(interp, "\n\t(in command executed by spinbox)");
4299 Tcl_BackgroundError(interp);
4286 Tcl_BackgroundException(interp, code);
43004287
43014288 /*
43024289 * Yes, it's an error, but a bg one, so we return OK
43054292 return TCL_OK;
43064293 }
43074294
4308 Tcl_SetResult(interp, NULL, 0);
4295 Tcl_ResetResult(interp);
43094296 }
43104297
43114298 return TCL_OK;
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkError.c,v 1.7 2008/08/19 15:52:11 georgeps Exp $
14 * RCS: @(#) $Id: tkError.c,v 1.8 2008/11/08 18:44:39 dkf Exp $
1515 */
1616
1717 #include "tkInt.h"
247247 && (errorPtr->lastRequest < errEventPtr->serial))) {
248248 continue;
249249 }
250 if (errorPtr->errorProc == NULL || (*errorPtr->errorProc)(
251 errorPtr->clientData, errEventPtr) == 0) {
250 if (errorPtr->errorProc == NULL ||
251 errorPtr->errorProc(errorPtr->clientData, errEventPtr) == 0) {
252252 return 0;
253253 }
254254 }
280280 */
281281
282282 couldntHandle:
283 return (*defaultHandler)(display, errEventPtr);
283 return defaultHandler(display, errEventPtr);
284284 }
285285
286286 /*
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkEvent.c,v 1.36 2008/08/05 20:31:08 jenglish Exp $
14 * RCS: @(#) $Id: tkEvent.c,v 1.37 2008/11/08 18:44:39 dkf Exp $
1515 */
1616
1717 #include "tkInt.h"
789789 int done;
790790
791791 tsdPtr->handlersActive++;
792 done = (*curPtr->proc)(curPtr->clientData, eventPtr);
792 done = curPtr->proc(curPtr->clientData, eventPtr);
793793 tsdPtr->handlersActive--;
794794 if (done) {
795795 return done;
13821382 for (handlerPtr = winPtr->handlerList; handlerPtr != NULL; ) {
13831383 if ((handlerPtr->mask & mask) != 0) {
13841384 ip.nextHandler = handlerPtr->nextPtr;
1385 (*(handlerPtr->proc))(handlerPtr->clientData, eventPtr);
1385 handlerPtr->proc(handlerPtr->clientData, eventPtr);
13861386 handlerPtr = ip.nextHandler;
13871387 } else {
13881388 handlerPtr = handlerPtr->nextPtr;
17861786 return 0;
17871787 }
17881788 if (tsdPtr->restrictProc != NULL) {
1789 result = (*tsdPtr->restrictProc)(tsdPtr->restrictArg, &wevPtr->event);
1789 result = tsdPtr->restrictProc(tsdPtr->restrictArg, &wevPtr->event);
17901790 if (result != TK_PROCESS_EVENT) {
17911791 if (result == TK_DEFER_EVENT) {
17921792 return 0;
20522052
20532053 firstExitPtr = exitPtr->nextPtr;
20542054 Tcl_MutexUnlock(&exitMutex);
2055 (*exitPtr->proc)(exitPtr->clientData);
2055 exitPtr->proc(exitPtr->clientData);
20562056 ckfree((char *) exitPtr);
20572057 Tcl_MutexLock(&exitMutex);
20582058 }
21022102 */
21032103
21042104 tsdPtr->firstExitPtr = exitPtr->nextPtr;
2105 (*exitPtr->proc)(exitPtr->clientData);
2105 exitPtr->proc(exitPtr->clientData);
21062106 ckfree((char *) exitPtr);
21072107 }
21082108 }
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkFileFilter.c,v 1.11 2008/04/27 22:38:56 dkf Exp $
11 * RCS: @(#) $Id: tkFileFilter.c,v 1.12 2008/12/07 16:34:12 das Exp $
1212 */
1313
1414 #include "tkInt.h"
337337 globPtr->next = NULL;
338338 }
339339 }
340 if (ostypeCount > 0 && ostypeList != NULL) {
340 if (ostypeList != NULL && ostypeCount > 0) {
341341 if (macRoman == NULL) {
342342 macRoman = Tcl_GetEncoding(NULL, "macRoman");
343343 }
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkFocus.c,v 1.17 2008/04/27 22:38:56 dkf Exp $
11 * RCS: @(#) $Id: tkFocus.c,v 1.20 2008/11/23 21:58:24 patthoyts Exp $
1212 */
1313
1414 #include "tkInt.h"
6969 } DisplayFocusInfo;
7070
7171 /*
72 * The following magic value is stored in the "send_event" field of FocusIn
73 * and FocusOut events that are generated in this file. This allows us to
74 * separate "real" events coming from the server from those that we generated.
75 */
76
77 #define GENERATED_EVENT_MAGIC ((Bool) 0x547321ac)
78
79 /*
8072 * Debugging support...
8173 */
8274
119111 int objc, /* Number of arguments. */
120112 Tcl_Obj *const objv[]) /* Argument objects. */
121113 {
122 static const char *focusOptions[] = {
114 static const char *const focusOptions[] = {
123115 "-displayof", "-force", "-lastfor", NULL
124116 };
125117 Tk_Window tkwin = clientData;
289281 * pass the event through to Tk bindings.
290282 */
291283
292 if (eventPtr->xfocus.send_event == GENERATED_EVENT_MAGIC) {
284 if (eventPtr->xfocus.send_event == GENERATED_FOCUS_EVENT_MAGIC) {
293285 eventPtr->xfocus.send_event = 0;
294286 return 1;
295287 }
907899 }
908900
909901 event.xfocus.serial = LastKnownRequestProcessed(winPtr->display);
910 event.xfocus.send_event = GENERATED_EVENT_MAGIC;
902 event.xfocus.send_event = GENERATED_FOCUS_EVENT_MAGIC;
911903 event.xfocus.display = winPtr->display;
912904 event.xfocus.mode = NotifyNormal;
913905 TkInOutEvents(&event, sourcePtr, destPtr, FocusOut, FocusIn,
10581050 */
10591051
10601052 void
1061 TkFocusSplit(winPtr)
1062 TkWindow *winPtr; /* Window is the new toplevel. Any focus point
1053 TkFocusSplit(
1054 TkWindow *winPtr) /* Window is the new toplevel. Any focus point
10631055 * at or below window must be moved to this
10641056 * new toplevel. */
10651057 {
11121104 * See if current focusWin is child of the new toplevel.
11131105 */
11141106
1115 for (subWinPtr = tlFocusPtr->focusWinPtr;
1107 for (subWinPtr = tlFocusPtr->focusWinPtr;
11161108 subWinPtr && subWinPtr != winPtr && subWinPtr != topLevelPtr;
11171109 subWinPtr = subWinPtr->parentPtr) {
11181110 /* EMPTY */
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkFont.c,v 1.46 2008/10/05 21:23:25 dkf Exp $
12 * RCS: @(#) $Id: tkFont.c,v 1.51 2008/12/07 16:34:12 das Exp $
1313 */
1414
1515 #include "tkInt.h"
1616 #include "tkFont.h"
17
18 #define ROUND16(x) ((short)((x) + 0.5))
1719
1820 /*
1921 * The following structure is used to keep track of all the fonts that exist
164166 * configuring a set of font attributes.
165167 */
166168
167 static const char *fontOpt[] = {
169 static const char *const fontOpt[] = {
168170 "-family",
169171 "-size",
170172 "-weight",
189191 * the alias list are also automatically tried.
190192 */
191193
192 static char *timesAliases[] = {
194 static const char *const timesAliases[] = {
193195 "Times", /* Unix. */
194196 "Times New Roman", /* Windows. */
195197 "New York", /* Mac. */
196198 NULL
197199 };
198200
199 static char *helveticaAliases[] = {
201 static const char *const helveticaAliases[] = {
200202 "Helvetica", /* Unix. */
201203 "Arial", /* Windows. */
202204 "Geneva", /* Mac. */
203205 NULL
204206 };
205207
206 static char *courierAliases[] = {
208 static const char *const courierAliases[] = {
207209 "Courier", /* Unix and Mac. */
208210 "Courier New", /* Windows. */
209211 NULL
210212 };
211213
212 static char *minchoAliases[] = {
214 static const char *const minchoAliases[] = {
213215 "mincho", /* Unix. */
214216 "\357\274\255\357\274\263 \346\230\216\346\234\235",
215217 /* Windows (MS mincho). */
218220 NULL
219221 };
220222
221 static char *gothicAliases[] = {
223 static const char *const gothicAliases[] = {
222224 "gothic", /* Unix. */
223225 "\357\274\255\357\274\263 \343\202\264\343\202\267\343\203\203\343\202\257",
224226 /* Windows (MS goshikku). */
227229 NULL
228230 };
229231
230 static char *dingbatsAliases[] = {
232 static const char *const dingbatsAliases[] = {
231233 "dingbats", "zapfdingbats", "itc zapfdingbats",
232234 /* Unix. */
233235 /* Windows. */
235237 NULL
236238 };
237239
238 static char **fontAliases[] = {
240 static const char *const *const fontAliases[] = {
239241 timesAliases,
240242 helveticaAliases,
241243 courierAliases,
251253 * be examined also.
252254 */
253255
254 static char *systemClass[] = {
256 static const char *const systemClass[] = {
255257 "fixed", /* Unix. */
256258 /* Windows. */
257259 "chicago", "osaka", "sistemny",
259261 NULL
260262 };
261263
262 static char *serifClass[] = {
264 static const char *const serifClass[] = {
263265 "times", "palatino", "mincho",
264266 /* All platforms. */
265267 "song ti", /* Unix. */
269271 NULL
270272 };
271273
272 static char *sansClass[] = {
274 static const char *const sansClass[] = {
273275 "helvetica", "gothic", /* All platforms. */
274276 /* Unix. */
275277 "ms sans serif", "traditional arabic",
278280 NULL
279281 };
280282
281 static char *monoClass[] = {
283 static const char *const monoClass[] = {
282284 "courier", "gothic", /* All platforms. */
283285 "fangsong ti", /* Unix. */
284286 "simplified arabic fixed", /* Windows. */
286288 NULL
287289 };
288290
289 static char *symbolClass[] = {
291 static const char *const symbolClass[] = {
290292 "symbol", "dingbats", "wingdings", NULL
291293 };
292294
293 static char **fontFallbacks[] = {
295 static const char *const *const fontFallbacks[] = {
294296 systemClass,
295297 serifClass,
296298 sansClass,
305307 * found, all font families in the system are examined.
306308 */
307309
308 static char *globalFontClass[] = {
310 static const char *const globalFontClass[] = {
309311 "symbol", /* All platforms. */
310312 /* Unix. */
311313 "lucida sans unicode", /* Windows. */
346348 * font object points to the TkFont structure for the font, or NULL.
347349 */
348350
349 Tcl_ObjType tkFontObjType = {
351 const Tcl_ObjType tkFontObjType = {
350352 "font", /* name */
351353 FreeFontObjProc, /* freeIntRepProc */
352354 DupFontObjProc, /* dupIntRepProc */
473475 int index;
474476 Tk_Window tkwin;
475477 TkFontInfo *fiPtr;
476 static const char *optionStrings[] = {
478 static const char *const optionStrings[] = {
477479 "actual", "configure", "create", "delete",
478480 "families", "measure", "metrics", "names",
479481 NULL
740742 Tk_Font tkfont;
741743 int skip, index, i;
742744 const TkFontMetrics *fmPtr;
743 static const char *switches[] = {
745 static const char *const switches[] = {
744746 "-ascent", "-descent", "-linespace", "-fixed", NULL
745747 };
746748
887889 Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc);
888890
889891 if (proc != NULL) {
890 (*proc)(winPtr->instanceData);
892 proc(winPtr->instanceData);
891893 }
892894
893895 /*
13461348 Tcl_GetString(objPtr);
13471349 typePtr = objPtr->typePtr;
13481350 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
1349 (*typePtr->freeIntRepProc)(objPtr);
1351 typePtr->freeIntRepProc(objPtr);
13501352 }
13511353 objPtr->typePtr = &tkFontObjType;
13521354 objPtr->internalRep.twoPtrValue.ptr1 = NULL;
23092311 }
23102312 }
23112313
2314 void
2315 TkDrawAngledTextLayout(
2316 Display *display, /* Display on which to draw. */
2317 Drawable drawable, /* Window or pixmap in which to draw. */
2318 GC gc, /* Graphics context to use for drawing text. */
2319 Tk_TextLayout layout, /* Layout information, from a previous call to
2320 * Tk_ComputeTextLayout(). */
2321 int x, int y, /* Upper-left hand corner of rectangle in
2322 * which to draw (pixels). */
2323 double angle,
2324 int firstChar, /* The index of the first character to draw
2325 * from the given text item. 0 specfies the
2326 * beginning. */
2327 int lastChar) /* The index just after the last character to
2328 * draw from the given text item. A number < 0
2329 * means to draw all characters. */
2330 {
2331 TextLayout *layoutPtr = (TextLayout *) layout;
2332 int i, numDisplayChars, drawX;
2333 const char *firstByte, *lastByte;
2334 LayoutChunk *chunkPtr;
2335 double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
2336
2337 if (layoutPtr == NULL) {
2338 return;
2339 }
2340
2341 if (lastChar < 0) {
2342 lastChar = 100000000;
2343 }
2344 chunkPtr = layoutPtr->chunks;
2345 for (i = 0; i < layoutPtr->numChunks; i++) {
2346 numDisplayChars = chunkPtr->numDisplayChars;
2347 if ((numDisplayChars > 0) && (firstChar < numDisplayChars)) {
2348 double dx, dy;
2349
2350 if (firstChar <= 0) {
2351 drawX = 0;
2352 firstChar = 0;
2353 firstByte = chunkPtr->start;
2354 } else {
2355 firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar);
2356 Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start,
2357 firstByte - chunkPtr->start, -1, 0, &drawX);
2358 }
2359 if (lastChar < numDisplayChars) {
2360 numDisplayChars = lastChar;
2361 }
2362 lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
2363 dx = cosA * (chunkPtr->x + drawX) + sinA * (chunkPtr->y);
2364 dy = -sinA * (chunkPtr->x + drawX) + cosA * (chunkPtr->y);
2365 TkpDrawAngledChars(display, drawable, gc, layoutPtr->tkfont,
2366 firstByte, lastByte - firstByte, x+dx, y+dy, angle);
2367 }
2368 firstChar -= chunkPtr->numChars;
2369 lastChar -= chunkPtr->numChars;
2370 if (lastChar <= 0) {
2371 break;
2372 }
2373 chunkPtr++;
2374 }
2375 }
2376
23122377 /*
23132378 *---------------------------------------------------------------------------
23142379 *
23542419 XFillRectangle(display, drawable, gc, x + xx,
23552420 y + yy + fontPtr->fm.ascent + fontPtr->underlinePos,
23562421 (unsigned) width, (unsigned) fontPtr->underlineHeight);
2422 }
2423 }
2424
2425 void
2426 TkUnderlineAngledTextLayout(
2427 Display *display, /* Display on which to draw. */
2428 Drawable drawable, /* Window or pixmap in which to draw. */
2429 GC gc, /* Graphics context to use for drawing text. */
2430 Tk_TextLayout layout, /* Layout information, from a previous call to
2431 * Tk_ComputeTextLayout(). */
2432 int x, int y, /* Upper-left hand corner of rectangle in
2433 * which to draw (pixels). */
2434 double angle,
2435 int underline) /* Index of the single character to underline,
2436 * or -1 for no underline. */
2437 {
2438 int xx, yy, width, height;
2439
2440 if (angle == 0.0) {
2441 Tk_UnderlineTextLayout(display, drawable, gc, layout, x,y, underline);
2442 return;
2443 }
2444
2445 if ((Tk_CharBbox(layout, underline, &xx, &yy, &width, &height) != 0)
2446 && (width != 0)) {
2447 TextLayout *layoutPtr = (TextLayout *) layout;
2448 TkFont *fontPtr = (TkFont *) layoutPtr->tkfont;
2449 double sinA = sin(angle*PI/180), cosA = cos(angle*PI/180);
2450 double dy = yy + fontPtr->fm.ascent + fontPtr->underlinePos;
2451 XPoint points[5];
2452
2453 /*
2454 * Note that we're careful to only round a double value once, which
2455 * minimizes roundoff errors.
2456 */
2457
2458 points[0].x = x + ROUND16(xx*cosA + dy*sinA);
2459 points[0].y = y + ROUND16(dy*cosA - xx*sinA);
2460 points[1].x = x + ROUND16(xx*cosA + dy*sinA + width*cosA);
2461 points[1].y = y + ROUND16(dy*cosA - xx*sinA - width*sinA);
2462 if (fontPtr->underlineHeight == 1) {
2463 /*
2464 * Thin underlines look better when rotated when drawn as a line
2465 * rather than a rectangle; the rasterizer copes better.
2466 */
2467
2468 XDrawLines(display, drawable, gc, points, 2, CoordModeOrigin);
2469 } else {
2470 points[2].x = x + ROUND16(xx*cosA + dy*sinA + width*cosA
2471 - fontPtr->underlineHeight*sinA);
2472 points[2].y = y + ROUND16(dy*cosA - xx*sinA - width*sinA
2473 + fontPtr->underlineHeight*cosA);
2474 points[3].x = x + ROUND16(xx*cosA + dy*sinA
2475 - fontPtr->underlineHeight*sinA);
2476 points[3].y = y + ROUND16(dy*cosA - xx*sinA
2477 + fontPtr->underlineHeight*cosA);
2478 points[4].x = points[0].x;
2479 points[4].y = points[0].y;
2480 XFillPolygon(display, drawable, gc, points, 5, Complex,
2481 CoordModeOrigin);
2482 XDrawLines(display, drawable, gc, points, 5, CoordModeOrigin);
2483 }
23572484 }
23582485 }
23592486
25472674 {
25482675 TextLayout *layoutPtr;
25492676 LayoutChunk *chunkPtr;
2550 int i, x, w;
2677 int i, x = 0, w;
25512678 Tk_Font tkfont;
25522679 TkFont *fontPtr;
25532680 const char *end;
28002927 chunkPtr++;
28012928 }
28022929 return result;
2930 }
2931
2932 /*
2933 *---------------------------------------------------------------------------
2934 *
2935 * TkIntersectAngledTextLayout --
2936 *
2937 * Determines whether a text layout that has been turned by an angle
2938 * about its top-left coordinae lies entirely inside, entirely outside,
2939 * or overlaps a given rectangle. Non-displaying space characters that
2940 * occur at the end of individual lines in the text layout are ignored
2941 * for intersection calculations.
2942 *
2943 * Results:
2944 * The return value is -1 if the text layout is entirely outside of the
2945 * rectangle, 0 if it overlaps, and 1 if it is entirely inside of the
2946 * rectangle.
2947 *
2948 * Side effects:
2949 * None.
2950 *
2951 *---------------------------------------------------------------------------
2952 */
2953
2954 static inline int
2955 PointInQuadrilateral(
2956 double qx[],
2957 double qy[],
2958 double x,
2959 double y)
2960 {
2961 int i;
2962
2963 for (i=0 ; i<4 ; i++) {
2964 double sideDX = qx[(i+1)%4] - qx[i];
2965 double sideDY = qy[(i+1)%4] - qy[i];
2966 double dx = x - qx[i];
2967 double dy = y - qy[i];
2968
2969 if (sideDX*dy < sideDY*dx) {
2970 return 0;
2971 }
2972 }
2973 return 1;
2974 }
2975
2976 static inline int
2977 sign(
2978 double value)
2979 {
2980 if (value < 0.0) return -1;
2981 if (value > 0.0) return 1;
2982 return 0;
2983 }
2984
2985 static inline int
2986 SidesIntersect(
2987 double ax1, double ay1, double ax2, double ay2,
2988 double bx1, double by1, double bx2, double by2)
2989 {
2990 #if 0
2991 /* http://www.freelunchdesign.com/cgi-bin/codwiki.pl?DiscussionTopics/CollideMeUpBaby */
2992
2993 double a1, b1, c1, a2, b2, c2, r1, r2, r3, r4, denom;
2994
2995 a1 = ay2 - ay1;
2996 b1 = ax1 - ax2;
2997 c1 = (ax2 * ay1) - (ax1 * ay2);
2998 r3 = (a1 * bx1) + (b1 * by1) + c1;
2999 r4 = (a1 * bx2) + (b1 * by2) + c1;
3000 if ((r3 != 0.0) && (r4 != 0.0) && (r3*r4 > 0.0)) {
3001 return 0;
3002 }
3003
3004 a2 = by2 - by1;
3005 b2 = bx1 - bx2;
3006 c2 = (bx2 * by1) - (bx1 * by2);
3007 r1 = (a2 * ax1) + (b2 * ay1) + c2;
3008 r2 = (a2 * ax2) + (b2 * ay2) + c2;
3009 if ((r1 != 0.0) && (r2 != 0.0) && (r1*r2 > 0.0)) {
3010 return 0;
3011 }
3012
3013 denom = (a1 * b2) - (a2 * b1);
3014 return (denom != 0.0);
3015 #else
3016 /*
3017 * A more efficient version. Two line segments intersect if, when seen
3018 * from the perspective of one line, the two endpoints of the other
3019 * segment lie on opposite sides of the line, and vice versa. "Lie on
3020 * opposite sides" is computed by taking the cross products and seeing if
3021 * they are of opposite signs.
3022 */
3023
3024 double dx, dy, dx1, dy1;
3025
3026 dx = ax2 - ax1;
3027 dy = ay2 - ay1;
3028 dx1 = bx1 - ax1;
3029 dy1 = by1 - ay1;
3030 if ((dx*dy1-dy*dx1 > 0.0) == (dx*(by2-ay1)-dy*(bx2-ax1) > 0.0)) {
3031 return 0;
3032 }
3033 dx = bx2 - bx1;
3034 dy = by2 - by1;
3035 if ((dy*dx1-dx*dy1 > 0.0) == (dx*(ay2-by1)-dy*(ax2-bx1) > 0.0)) {
3036 return 0;
3037 }
3038 return 1;
3039 #endif
3040 }
3041
3042 int
3043 TkIntersectAngledTextLayout(
3044 Tk_TextLayout layout, /* Layout information, from a previous call to
3045 * Tk_ComputeTextLayout(). */
3046 int x, int y, /* Upper-left hand corner, in pixels, of
3047 * rectangular area to compare with text
3048 * layout. Coordinates are with respect to the
3049 * upper-left hand corner of the text layout
3050 * itself. */
3051 int width, int height, /* The width and height of the above
3052 * rectangular area, in pixels. */
3053 double angle)
3054 {
3055 int i, x1, y1, x2, y2;
3056 TextLayout *layoutPtr;
3057 LayoutChunk *chunkPtr;
3058 TkFont *fontPtr;
3059 double c = cos(angle * PI/180.0), s = sin(angle * PI/180.0);
3060 double rx[4], ry[4];
3061
3062 if (angle == 0.0) {
3063 return Tk_IntersectTextLayout(layout, x, y, width, height);
3064 }
3065
3066 /*
3067 * Compute the coordinates of the rectangle, rotated into text layout
3068 * space.
3069 */
3070
3071 rx[0] = x*c - y*s;
3072 ry[0] = y*c + x*s;
3073 rx[1] = (x+width)*c - y*s;
3074 ry[1] = y*c + (x+width)*s;
3075 rx[2] = (x+width)*c - (y+height)*s;
3076 ry[2] = (y+height)*c + (x+width)*s;
3077 rx[3] = x*c - (y+height)*s;
3078 ry[3] = (y+height)*c + x*s;
3079
3080 /*
3081 * Want to know if all chunks are inside the rectangle, or if there is any
3082 * overlap. First, we check to see if all chunks are inside; if and only
3083 * if they are, we're in the "inside" case.
3084 */
3085
3086 layoutPtr = (TextLayout *) layout;
3087 chunkPtr = layoutPtr->chunks;
3088 fontPtr = (TkFont *) layoutPtr->tkfont;
3089
3090 for (i=0 ; i<layoutPtr->numChunks ; i++,chunkPtr++) {
3091 if (chunkPtr->start[0] == '\n') {
3092 /*
3093 * Newline characters are not counted when computing area
3094 * intersection (but tab characters would still be considered).
3095 */
3096
3097 continue;
3098 }
3099
3100 x1 = chunkPtr->x;
3101 y1 = chunkPtr->y - fontPtr->fm.ascent;
3102 x2 = chunkPtr->x + chunkPtr->displayWidth;
3103 y2 = chunkPtr->y + fontPtr->fm.descent;
3104 if ( !PointInQuadrilateral(rx, ry, x1, y1) ||
3105 !PointInQuadrilateral(rx, ry, x2, y1) ||
3106 !PointInQuadrilateral(rx, ry, x2, y2) ||
3107 !PointInQuadrilateral(rx, ry, x1, y2)) {
3108 goto notInside;
3109 }
3110 }
3111 return 1;
3112
3113 /*
3114 * Next, check to see if all the points of the rectangle are inside a
3115 * single chunk; if they are, we're in an "overlap" case.
3116 */
3117
3118 notInside:
3119 chunkPtr = layoutPtr->chunks;
3120
3121 for (i=0 ; i<layoutPtr->numChunks ; i++,chunkPtr++) {
3122 double cx[4], cy[4];
3123 if (chunkPtr->start[0] == '\n') {
3124 /*
3125 * Newline characters are not counted when computing area
3126 * intersection (but tab characters would still be considered).
3127 */
3128
3129 continue;
3130 }
3131
3132 cx[0] = cx[3] = chunkPtr->x;
3133 cy[0] = cy[1] = chunkPtr->y - fontPtr->fm.ascent;
3134 cx[1] = cx[2] = chunkPtr->x + chunkPtr->displayWidth;
3135 cy[2] = cy[3] = chunkPtr->y + fontPtr->fm.descent;
3136 if ( !PointInQuadrilateral(cx, cy, rx[0], ry[0]) ||
3137 !PointInQuadrilateral(cx, cy, rx[1], ry[1]) ||
3138 !PointInQuadrilateral(cx, cy, rx[2], ry[2]) ||
3139 !PointInQuadrilateral(cx, cy, rx[3], ry[3])) {
3140 goto notReverseInside;
3141 }
3142 }
3143 return 0;
3144
3145 /*
3146 * If we're overlapping now, we must be partially in and out of at least
3147 * one chunk. If that is the case, there must be one line segment of the
3148 * rectangle that is touching or crossing a line segment of a chunk.
3149 */
3150
3151 notReverseInside:
3152 chunkPtr = layoutPtr->chunks;
3153
3154 for (i=0 ; i<layoutPtr->numChunks ; i++,chunkPtr++) {
3155 int j;
3156
3157 if (chunkPtr->start[0] == '\n') {
3158 /*
3159 * Newline characters are not counted when computing area
3160 * intersection (but tab characters would still be considered).
3161 */
3162
3163 continue;
3164 }
3165
3166 x1 = chunkPtr->x;
3167 y1 = chunkPtr->y - fontPtr->fm.ascent;
3168 x2 = chunkPtr->x + chunkPtr->displayWidth;
3169 y2 = chunkPtr->y + fontPtr->fm.descent;
3170
3171 for (j=0 ; j<4 ; j++) {
3172 int k = (j+1) % 4;
3173 if ( SidesIntersect(rx[j],ry[j], rx[k],ry[k], x1,y1, x2,y1) ||
3174 SidesIntersect(rx[j],ry[j], rx[k],ry[k], x2,y1, x2,y2) ||
3175 SidesIntersect(rx[j],ry[j], rx[k],ry[k], x2,y2, x1,y2) ||
3176 SidesIntersect(rx[j],ry[j], rx[k],ry[k], x1,y2, x1,y1)) {
3177 return 0;
3178 }
3179 }
3180 }
3181
3182 /*
3183 * They must be wholly non-overlapping.
3184 */
3185
3186 return -1;
28033187 }
28043188
28053189 /*
36734057 *-------------------------------------------------------------------------
36744058 */
36754059
3676 char **
4060 const char *const *
36774061 TkFontGetAliasList(
36784062 const char *faceName) /* Font name to test for aliases. */
36794063 {
37064090 *-------------------------------------------------------------------------
37074091 */
37084092
3709 char ***
4093 const char *const *const *
37104094 TkFontGetFallbacks(void)
37114095 {
37124096 return fontFallbacks;
37314115 *-------------------------------------------------------------------------
37324116 */
37334117
3734 char **
4118 const char *const *
37354119 TkFontGetGlobalClass(void)
37364120 {
37374121 return globalFontClass;
37544138 *-------------------------------------------------------------------------
37554139 */
37564140
3757 char **
4141 const char *const *
37584142 TkFontGetSymbolClass(void)
37594143 {
37604144 return symbolClass;
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkFont.h,v 1.11 2008/05/02 10:28:18 dkf Exp $
12 * RCS: @(#) $Id: tkFont.h,v 1.13 2008/11/05 23:29:58 nijtmans Exp $
1313 */
1414
1515 #ifndef _TKFONT
196196
197197 MODULE_SCOPE int TkFontParseXLFD(const char *string,
198198 TkFontAttributes *faPtr, TkXLFDAttributes *xaPtr);
199 MODULE_SCOPE char ** TkFontGetAliasList(const char *faceName);
200 MODULE_SCOPE char *** TkFontGetFallbacks(void);
199 MODULE_SCOPE const char *const * TkFontGetAliasList(const char *faceName);
200 MODULE_SCOPE const char *const *const * TkFontGetFallbacks(void);
201201 MODULE_SCOPE int TkFontGetPixels(Tk_Window tkwin, int size);
202202 MODULE_SCOPE int TkFontGetPoints(Tk_Window tkwin, int size);
203 MODULE_SCOPE char ** TkFontGetGlobalClass(void);
204 MODULE_SCOPE char ** TkFontGetSymbolClass(void);
203 MODULE_SCOPE const char *const * TkFontGetGlobalClass(void);
204 MODULE_SCOPE const char *const * TkFontGetSymbolClass(void);
205205 MODULE_SCOPE int TkCreateNamedFont(Tcl_Interp *interp, Tk_Window tkwin,
206206 const char *name, TkFontAttributes *faPtr);
207207 MODULE_SCOPE int TkDeleteNamedFont(Tcl_Interp *interp,
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkFrame.c,v 1.33 2008/07/23 23:24:21 nijtmans Exp $
13 * RCS: @(#) $Id: tkFrame.c,v 1.37 2008/11/15 00:00:27 patthoyts Exp $
1414 */
1515
1616 #include "default.h"
163163 LABELANCHOR_W, LABELANCHOR_WN, LABELANCHOR_WS
164164 };
165165
166 static char *labelAnchorStrings[] = {
166 static const char *labelAnchorStrings[] = {
167167 "e", "en", "es", "n", "ne", "nw", "s", "se", "sw", "w", "wn", "ws",
168168 NULL
169169 };
282282 * Class names for widgets, indexed by FrameType.
283283 */
284284
285 static char *classNames[] = {"Frame", "Toplevel", "Labelframe"};
285 static const char *const classNames[] = {"Frame", "Toplevel", "Labelframe"};
286286
287287 /*
288288 * The following table maps from FrameType to the option template for that
304304 int objc, Tcl_Obj *const objv[]);
305305 static int CreateFrame(ClientData clientData, Tcl_Interp *interp,
306306 int objc, Tcl_Obj *const argv[],
307 enum FrameType type, char *appName);
307 enum FrameType type, const char *appName);
308308 static void DestroyFrame(char *memPtr);
309309 static void DestroyFramePartly(Frame *framePtr);
310310 static void DisplayFrame(ClientData clientData);
417417 ClientData clientData, /* Either NULL or pointer to option table. */
418418 Tcl_Interp *interp, /* Current interpreter. */
419419 int argc, /* Number of arguments. */
420 char **argv, /* Argument strings. */
420 const char *const *argv, /* Argument strings. */
421421 int toplevel, /* Non-zero means create a toplevel window,
422422 * zero means create a frame. */
423 char *appName) /* Should only be non-NULL if there is no main
423 const char *appName) /* Should only be non-NULL if there is no main
424424 * window associated with the interpreter.
425425 * Gives the base name to use for the new
426426 * application. */
449449 int objc, /* Number of arguments. */
450450 Tcl_Obj *const objv[], /* Argument objects. */
451451 enum FrameType type, /* What widget type to create. */
452 char *appName) /* Should only be non-NULL if there are no
452 const char *appName) /* Should only be non-NULL if there are no
453453 * Main window associated with the
454454 * interpreter. Gives the base name to use for
455455 * the new application. */
555555 }
556556 if (newWin == NULL) {
557557 goto error;
558 } else {
559 /*
560 * Mark Tk frames as suitable candidates for [wm manage]
561 */
562 TkWindow *winPtr = (TkWindow *)newWin;
563 winPtr->flags |= TK_WM_MANAGEABLE;
558564 }
559565 if (className == NULL) {
560566 className = Tk_GetOption(newWin, "class", "Class");
666672 if (type == TYPE_TOPLEVEL) {
667673 Tcl_DoWhenIdle(MapFrame, framePtr);
668674 }
669 Tcl_SetResult(interp, Tk_PathName(newWin), TCL_STATIC);
675 Tcl_SetObjResult(interp, TkNewWindowObj(newWin));
670676 return TCL_OK;
671677
672678 error:
701707 int objc, /* Number of arguments. */
702708 Tcl_Obj *const objv[]) /* Argument objects. */
703709 {
704 static const char *frameOptions[] = {
710 static const char *const frameOptions[] = {
705711 "cget", "configure", NULL
706712 };
707713 enum options {
933939 ckfree(oldMenuName);
934940 }
935941 return TCL_ERROR;
936 } else {
937 Tk_FreeSavedOptions(&savedOptions);
938 }
942 }
943 Tk_FreeSavedOptions(&savedOptions);
939944
940945 /*
941946 * A few of the options require additional processing.
12661271 if ((labelframePtr->labelAnchor >= LABELANCHOR_N) &&
12671272 (labelframePtr->labelAnchor <= LABELANCHOR_SW)) {
12681273 maxWidth -= padding;
1269 if (maxWidth < 1) maxWidth = 1;
1274 if (maxWidth < 1) {
1275 maxWidth = 1;
1276 }
12701277 } else {
12711278 maxHeight -= padding;
1272 if (maxHeight < 1) maxHeight = 1;
1279 if (maxHeight < 1) {
1280 maxHeight = 1;
1281 }
12731282 }
12741283 if (labelframePtr->labelBox.width > maxWidth) {
12751284 labelframePtr->labelBox.width = maxWidth;
19151924 }
19161925
19171926 void
1918 TkMapTopFrame (tkwin)
1919 Tk_Window tkwin;
1927 TkMapTopFrame(
1928 Tk_Window tkwin)
19201929 {
19211930 Frame *framePtr = ((TkWindow*)tkwin)->instanceData;
19221931 Tk_OptionTable optionTable;
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkGeometry.c,v 1.13 2008/04/27 22:38:56 dkf Exp $
12 * RCS: @(#) $Id: tkGeometry.c,v 1.14 2008/11/08 18:44:40 dkf Exp $
1313 */
1414
1515 #include "tkInt.h"
9797 && ((winPtr->geomMgrPtr != mgrPtr)
9898 || (winPtr->geomData != clientData))
9999 && (winPtr->geomMgrPtr->lostSlaveProc != NULL)) {
100 (*winPtr->geomMgrPtr->lostSlaveProc)(winPtr->geomData, tkwin);
100 winPtr->geomMgrPtr->lostSlaveProc(winPtr->geomData, tkwin);
101101 }
102102
103103 winPtr->geomMgrPtr = mgrPtr;
153153 winPtr->reqHeight = reqHeight;
154154 if ((winPtr->geomMgrPtr != NULL)
155155 && (winPtr->geomMgrPtr->requestProc != NULL)) {
156 (*winPtr->geomMgrPtr->requestProc)(winPtr->geomData, tkwin);
156 winPtr->geomMgrPtr->requestProc(winPtr->geomData, tkwin);
157157 }
158158 }
159159
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkGet.c,v 1.14 2008/04/27 22:38:56 dkf Exp $
14 * RCS: @(#) $Id: tkGet.c,v 1.15 2008/10/17 23:18:37 nijtmans Exp $
1515 */
1616
1717 #include "tkInt.h"
3636 * used by Tk_GetAnchorFromObj and Tk_GetJustifyFromObj.
3737 */
3838
39 static const char *anchorStrings[] = {
39 static const char *const anchorStrings[] = {
4040 "n", "ne", "e", "se", "s", "sw", "w", "nw", "center", NULL
4141 };
42 static const char *justifyStrings[] = {
42 static const char *const justifyStrings[] = {
4343 "left", "right", "center", NULL
4444 };
4545
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkGrab.c,v 1.15 2008/07/23 23:24:23 nijtmans Exp $
11 * RCS: @(#) $Id: tkGrab.c,v 1.17 2008/11/23 21:58:24 patthoyts Exp $
1212 */
1313
1414 #include "tkInt.h"
131131 * we generated.
132132 */
133133
134 #define GENERATED_EVENT_MAGIC ((Bool) 0x147321ac)
134 #define GENERATED_GRAB_EVENT_MAGIC ((Bool) 0x147321ac)
135135
136136 /*
137137 * Mask that selects any of the state bits corresponding to buttons, plus
190190 char *arg;
191191 int index;
192192 int len;
193 static const char *optionStrings[] = {
193 static const char *const optionStrings[] = {
194194 "current", "release", "set", "status", NULL
195195 };
196 static const char *flagStrings[] = {
196 static const char *const flagStrings[] = {
197197 "-global", NULL
198198 };
199199 enum options {
721721 * serverWinPtr.
722722 */
723723
724 if (eventPtr->xcrossing.send_event != GENERATED_EVENT_MAGIC) {
724 if (eventPtr->xcrossing.send_event != GENERATED_GRAB_EVENT_MAGIC) {
725725 if ((eventPtr->type == LeaveNotify) &&
726726 (winPtr->flags & TK_TOP_HIERARCHY)) {
727727 dispPtr->serverWinPtr = NULL;
11501150 }
11511151
11521152 event.xcrossing.serial = LastKnownRequestProcessed(winPtr->display);
1153 event.xcrossing.send_event = GENERATED_EVENT_MAGIC;
1153 event.xcrossing.send_event = GENERATED_GRAB_EVENT_MAGIC;
11541154 event.xcrossing.display = winPtr->display;
11551155 event.xcrossing.root = RootWindow(winPtr->display, winPtr->screenNum);
11561156 event.xcrossing.time = TkCurrentTime(winPtr->dispPtr);
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkGrid.c,v 1.49 2008/07/23 23:24:23 nijtmans Exp $
10 * RCS: @(#) $Id: tkGrid.c,v 1.51 2008/11/08 22:52:29 dkf Exp $
1111 */
1212
1313 #include "tkInt.h"
333333 Tcl_Obj *const objv[]) /* Argument objects. */
334334 {
335335 Tk_Window tkwin = clientData;
336 static const char *optionStrings[] = {
336 static const char *const optionStrings[] = {
337337 "anchor", "bbox", "columnconfigure", "configure",
338338 "forget", "info", "location", "propagate", "remove",
339339 "rowconfigure", "size", "slaves", NULL
930930 int ok; /* temporary TCL result code */
931931 int i, j, first, last;
932932 char *string;
933 static const char *optionStrings[] = {
933 static const char *const optionStrings[] = {
934934 "-minsize", "-pad", "-uniform", "-weight", NULL
935935 };
936936 enum options {
13051305 Gridder *slavePtr;
13061306 int i, value, index;
13071307 int row = -1, column = -1;
1308 static const char *optionStrings[] = {
1308 static const char *const optionStrings[] = {
13091309 "-column", "-row", NULL
13101310 };
13111311 enum options { SLAVES_COLUMN, SLAVES_ROW };
13521352 slavePtr->row+slavePtr->numRows-1 < row)) {
13531353 continue;
13541354 }
1355 Tcl_ListObjAppendElement(interp, res,
1356 Tcl_NewStringObj(Tk_PathName(slavePtr->tkwin), -1));
1355 Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(slavePtr->tkwin));
13571356 }
13581357 Tcl_SetObjResult(interp, res);
13591358 return TCL_OK;
28842883 char *lastWindow; /* Use this window to base current row/col
28852884 * on */
28862885 int numSkip; /* Number of 'x' found */
2887 static const char *optionStrings[] = {
2886 static const char *const optionStrings[] = {
28882887 "-column", "-columnspan", "-in", "-ipadx", "-ipady",
28892888 "-padx", "-pady", "-row", "-rowspan", "-sticky", NULL
28902889 };
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkImage.c,v 1.38 2008/10/05 18:22:21 dkf Exp $
12 * RCS: @(#) $Id: tkImage.c,v 1.42 2008/11/12 09:56:51 dkf Exp $
1313 */
1414
1515 #include "tkInt.h"
1616
1717 /*
1818 * Each call to Tk_GetImage returns a pointer to one of the following
19 * structures, which is used as a token by clients (widgets) that
20 * display images.
19 * structures, which is used as a token by clients (widgets) that display
20 * images.
2121 */
2222
2323 typedef struct Image {
7373 Tk_ImageType *oldImageTypeList;
7474 /* First in a list of all known old-style
7575 * image types. */
76 int initialized; /* Set to 1 if we've initialized the
77 * structure. */
7678 } ThreadSpecificData;
7779 static Tcl_ThreadDataKey dataKey;
7880
8082 * Prototypes for local functions:
8183 */
8284
85 static void ImageTypeThreadExitProc(ClientData clientData);
8386 static void DeleteImage(ImageMaster *masterPtr);
8487 static void EventuallyDeleteImage(ImageMaster *masterPtr,
8588 int forgetImageHashNow);
8790 /*
8891 *----------------------------------------------------------------------
8992 *
93 * ImageTypeThreadExitProc --
94 *
95 * Clean up the registered list of image types.
96 *
97 * Results:
98 * None.
99 *
100 * Side effects:
101 * The thread's linked lists of photo image formats is deleted.
102 *
103 *----------------------------------------------------------------------
104 */
105
106 static void
107 ImageTypeThreadExitProc(
108 ClientData clientData) /* not used */
109 {
110 Tk_ImageType *freePtr;
111 ThreadSpecificData *tsdPtr =
112 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
113
114 while (tsdPtr->oldImageTypeList != NULL) {
115 freePtr = tsdPtr->oldImageTypeList;
116 tsdPtr->oldImageTypeList = tsdPtr->oldImageTypeList->nextPtr;
117 ckfree((char *) freePtr);
118 }
119 while (tsdPtr->imageTypeList != NULL) {
120 freePtr = tsdPtr->imageTypeList;
121 tsdPtr->imageTypeList = tsdPtr->imageTypeList->nextPtr;
122 ckfree((char *) freePtr);
123 }
124 }
125
126 /*
127 *----------------------------------------------------------------------
128 *
90129 * Tk_CreateOldImageType, Tk_CreateImageType --
91130 *
92131 * This function is invoked by an image manager to tell Tk about a new
105144
106145 void
107146 Tk_CreateOldImageType(
108 Tk_ImageType *typePtr) /* Structure describing the type. All of the
147 const Tk_ImageType *typePtr)
148 /* Structure describing the type. All of the
109149 * fields except "nextPtr" must be filled in
110 * by caller. Must not have been passed to
111 * Tk_CreateImageType previously. */
112 {
113 ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
114 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
115
116 typePtr->nextPtr = tsdPtr->oldImageTypeList;
117 tsdPtr->oldImageTypeList = typePtr;
150 * by caller. */
151 {
152 Tk_ImageType *copyPtr;
153 ThreadSpecificData *tsdPtr =
154 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
155
156 if (!tsdPtr->initialized) {
157 tsdPtr->initialized = 1;
158 Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
159 }
160 copyPtr = (Tk_ImageType *) ckalloc(sizeof(Tk_ImageType));
161 *copyPtr = *typePtr;
162 copyPtr->nextPtr = tsdPtr->oldImageTypeList;
163 tsdPtr->oldImageTypeList = copyPtr;
118164 }
119165
120166 void
121167 Tk_CreateImageType(
122 Tk_ImageType *typePtr) /* Structure describing the type. All of the
168 const Tk_ImageType *typePtr)
169 /* Structure describing the type. All of the
123170 * fields except "nextPtr" must be filled in
124 * by caller. Must not have been passed to
125 * Tk_CreateImageType previously. */
126 {
127 ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
128 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
129
130 typePtr->nextPtr = tsdPtr->imageTypeList;
131 tsdPtr->imageTypeList = typePtr;
171 * by caller. */
172 {
173 Tk_ImageType *copyPtr;
174 ThreadSpecificData *tsdPtr =
175 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
176
177 if (!tsdPtr->initialized) {
178 tsdPtr->initialized = 1;
179 Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
180 }
181 copyPtr = (Tk_ImageType *) ckalloc(sizeof(Tk_ImageType));
182 *copyPtr = *typePtr;
183 copyPtr->nextPtr = tsdPtr->imageTypeList;
184 tsdPtr->imageTypeList = copyPtr;
132185 }
133186
134187 /*
155208 int objc, /* Number of arguments. */
156209 Tcl_Obj *const objv[]) /* Argument strings. */
157210 {
158 static const char *imageOptions[] = {
211 static const char *const imageOptions[] = {
159212 "create", "delete", "height", "inuse", "names", "type", "types",
160213 "width", NULL
161214 };
173226 char idString[16 + TCL_INTEGER_SPACE];
174227 TkDisplay *dispPtr = winPtr->dispPtr;
175228 char *arg, *name;
176 ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
229 ThreadSpecificData *tsdPtr =
177230 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
178231
179232 if (objc < 2) {
189242 case IMAGE_CREATE: {
190243 Tcl_Obj **args;
191244 int oldimage = 0;
245
192246 if (objc < 3) {
193 Tcl_WrongNumArgs(interp, 2, objv, "type ?name? ?-option value ...?");
247 Tcl_WrongNumArgs(interp, 2, objv,
248 "type ?name? ?-option value ...?");
194249 return TCL_ERROR;
195250 }
196251
228283
229284 if ((objc == 3) || (*(arg = Tcl_GetString(objv[3])) == '-')) {
230285 Tcl_CmdInfo dummy;
286
231287 do {
232288 dispPtr->imageId++;
233289 sprintf(idString, "image%d", dispPtr->imageId);
282338 if (masterPtr->typePtr != NULL) {
283339 for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
284340 imagePtr = imagePtr->nextPtr) {
285 (*masterPtr->typePtr->freeProc)(imagePtr->instanceData,
341 masterPtr->typePtr->freeProc(imagePtr->instanceData,
286342 imagePtr->display);
287 (*imagePtr->changeProc)(imagePtr->widgetClientData,
288 0, 0, masterPtr->width, masterPtr->height,
343 imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
344 masterPtr->width, masterPtr->height,
289345 masterPtr->width, masterPtr->height);
290346 }
291 (*masterPtr->typePtr->deleteProc)(masterPtr->masterData);
347 masterPtr->typePtr->deleteProc(masterPtr->masterData);
292348 masterPtr->typePtr = NULL;
293349 }
294350 masterPtr->deleted = 0;
313369 args[objc] = NULL;
314370 }
315371 Tcl_Preserve(masterPtr);
316 if ((*typePtr->createProc)(interp, name, objc, args, typePtr,
317 (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK) {
372 if (typePtr->createProc(interp, name, objc, args, typePtr,
373 (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK){
318374 EventuallyDeleteImage(masterPtr, 0);
319375 Tcl_Release(masterPtr);
320376 if (oldimage) {
329385 masterPtr->typePtr = typePtr;
330386 for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
331387 imagePtr = imagePtr->nextPtr) {
332 imagePtr->instanceData = (*typePtr->getProc)(imagePtr->tkwin,
388 imagePtr->instanceData = typePtr->getProc(imagePtr->tkwin,
333389 masterPtr->masterData);
334390 }
335391 Tcl_SetResult(interp,
478534 masterPtr->height = imageHeight;
479535 for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
480536 imagePtr = imagePtr->nextPtr) {
481 (*imagePtr->changeProc)(imagePtr->widgetClientData, x, y,
482 width, height, imageWidth, imageHeight);
537 imagePtr->changeProc(imagePtr->widgetClientData, x, y, width, height,
538 imageWidth, imageHeight);
483539 }
484540 }
485541
566622 imagePtr->display = Tk_Display(tkwin);
567623 imagePtr->masterPtr = masterPtr;
568624 imagePtr->instanceData =
569 (*masterPtr->typePtr->getProc)(tkwin, masterPtr->masterData);
625 masterPtr->typePtr->getProc(tkwin, masterPtr->masterData);
570626 imagePtr->changeProc = changeProc;
571627 imagePtr->widgetClientData = clientData;
572628 imagePtr->nextPtr = masterPtr->instancePtr;
612668 */
613669
614670 if (masterPtr->typePtr != NULL) {
615 (*masterPtr->typePtr->freeProc)(imagePtr->instanceData,
671 masterPtr->typePtr->freeProc(imagePtr->instanceData,
616672 imagePtr->display);
617673 }
618674 prevPtr = masterPtr->instancePtr;
690746 */
691747
692748 if (imagePtr->masterPtr->typePtr->postscriptProc != NULL) {
693 return (*imagePtr->masterPtr->typePtr->postscriptProc)(
694 imagePtr->masterPtr->masterData, interp, tkwin, psinfo,
695 x, y, width, height, prepass);
749 return imagePtr->masterPtr->typePtr->postscriptProc(
750 imagePtr->masterPtr->masterData, interp, tkwin, psinfo,
751 x, y, width, height, prepass);
696752 }
697753
698754 if (prepass) {
711767 gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin));
712768 newGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
713769 if (newGC != None) {
714 XFillRectangle(Tk_Display(tkwin), pmap, newGC,
715 0, 0, (unsigned int)width, (unsigned int)height);
770 XFillRectangle(Tk_Display(tkwin), pmap, newGC, 0, 0,
771 (unsigned) width, (unsigned) height);
716772 Tk_FreeGC(Tk_Display(tkwin), newGC);
717773 }
718774
719775 Tk_RedrawImage(image, x, y, width, height, pmap, 0, 0);
720776
721777 ximage = XGetImage(Tk_Display(tkwin), pmap, 0, 0,
722 (unsigned int)width, (unsigned int)height, AllPlanes, ZPixmap);
778 (unsigned) width, (unsigned) height, AllPlanes, ZPixmap);
723779
724780 Tk_FreePixmap(Tk_Display(tkwin), pmap);
725781
800856 if ((imageY + height) > imagePtr->masterPtr->height) {
801857 height = imagePtr->masterPtr->height - imageY;
802858 }
803 (*imagePtr->masterPtr->typePtr->displayProc)(
804 imagePtr->instanceData, imagePtr->display, drawable,
805 imageX, imageY, width, height, drawableX, drawableY);
859 imagePtr->masterPtr->typePtr->displayProc(imagePtr->instanceData,
860 imagePtr->display, drawable, imageX, imageY, width, height,
861 drawableX, drawableY);
806862 }
807863
808864 /*
901957 if (typePtr != NULL) {
902958 for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
903959 imagePtr = imagePtr->nextPtr) {
904 (*typePtr->freeProc)(imagePtr->instanceData,
905 imagePtr->display);
906 (*imagePtr->changeProc)(imagePtr->widgetClientData, 0, 0,
960 typePtr->freeProc(imagePtr->instanceData, imagePtr->display);
961 imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
907962 masterPtr->width, masterPtr->height, masterPtr->width,
908963 masterPtr->height);
909964 }
910 (*typePtr->deleteProc)(masterPtr->masterData);
965 typePtr->deleteProc(masterPtr->masterData);
911966 }
912967 if (masterPtr->instancePtr == NULL) {
913968 if (masterPtr->hPtr != NULL) {
10111066 Tcl_Interp *interp, /* Interpreter in which the image was
10121067 * created. */
10131068 const char *name, /* Name of image. */
1014 Tk_ImageType **typePtrPtr) /* Points to location to fill in with pointer
1069 const Tk_ImageType **typePtrPtr)
1070 /* Points to location to fill in with pointer
10151071 * to type information for image. */
10161072 {
1073 TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp);
10171074 Tcl_HashEntry *hPtr;
1018 TkWindow *winPtr;
10191075 ImageMaster *masterPtr;
10201076
1021 winPtr = (TkWindow *) Tk_MainWindow(interp);
10221077 hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name);
10231078 if (hPtr == NULL) {
10241079 *typePtrPtr = NULL;
99 * See the file "license.terms" for information on usage and redistribution
1010 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkImgBmap.c,v 1.24 2008/07/23 23:24:21 nijtmans Exp $
12 * RCS: @(#) $Id: tkImgBmap.c,v 1.28 2008/12/09 21:22:56 dgp Exp $
1313 */
1414
1515 #include "tkInt.h"
7676
7777 static int GetByte(Tcl_Channel chan);
7878 static int ImgBmapCreate(Tcl_Interp *interp,
79 char *name, int argc, Tcl_Obj *const objv[],
80 Tk_ImageType *typePtr, Tk_ImageMaster master,
79 const char *name, int argc, Tcl_Obj *const objv[],
80 const Tk_ImageType *typePtr, Tk_ImageMaster master,
8181 ClientData *clientDataPtr);
8282 static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData);
8383 static void ImgBmapDisplay(ClientData clientData,
130130
131131 #define MAX_WORD_LENGTH 100
132132 typedef struct ParseInfo {
133 char *string; /* Next character of string data for bitmap,
133 const char *string; /* Next character of string data for bitmap,
134134 * or NULL if bitmap is being read from
135135 * file. */
136136 Tcl_Channel chan; /* File containing bitmap data, or NULL if no
152152 static int ImgBmapConfigureMaster(BitmapMaster *masterPtr,
153153 int argc, Tcl_Obj *const objv[], int flags);
154154 static int NextBitmapWord(ParseInfo *parseInfoPtr);
155
155
156156 /*
157157 *----------------------------------------------------------------------
158158 *
174174 ImgBmapCreate(
175175 Tcl_Interp *interp, /* Interpreter for application containing
176176 * image. */
177 char *name, /* Name to use for image. */
177 const char *name, /* Name to use for image. */
178178 int argc, /* Number of arguments. */
179179 Tcl_Obj *const argv[], /* Argument objects for options (doesn't
180180 * include image name or type). */
181 Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
181 const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
182182 Tk_ImageMaster master, /* Token for image, to be used by us in later
183183 * callbacks. */
184184 ClientData *clientDataPtr) /* Store manager's token for image here; it
208208 *clientDataPtr = masterPtr;
209209 return TCL_OK;
210210 }
211
211
212212 /*
213213 *----------------------------------------------------------------------
214214 *
312312 masterPtr->height, masterPtr->width, masterPtr->height);
313313 return TCL_OK;
314314 }
315
315
316316 /*
317317 *----------------------------------------------------------------------
318318 *
442442 Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc);
443443 }
444444 instancePtr->gc = None;
445 Tcl_AddErrorInfo(masterPtr->interp, "\n (while configuring image \"");
446 Tcl_AddErrorInfo(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
447 Tcl_AddErrorInfo(masterPtr->interp, "\")");
445 Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf(
446 "\n (while configuring image \"%s\")", Tk_NameOfImage(
447 masterPtr->tkMaster)));
448448 Tcl_BackgroundError(masterPtr->interp);
449449 }
450
450
451451 /*
452452 *----------------------------------------------------------------------
453453 *
473473 char *
474474 TkGetBitmapData(
475475 Tcl_Interp *interp, /* For reporting errors, or NULL. */
476 char *string, /* String describing bitmap. May be NULL. */
477 char *fileName, /* Name of file containing bitmap description.
476 const char *string, /* String describing bitmap. May be NULL. */
477 const char *fileName, /* Name of file containing bitmap description.
478478 * Used only if string is NULL. Must not be
479479 * NULL if string is NULL. */
480480 int *widthPtr, int *heightPtr,
649649 }
650650 return NULL;
651651 }
652
652
653653 /*
654654 *----------------------------------------------------------------------
655655 *
674674 ParseInfo *parseInfoPtr) /* Describes what we're reading and where we
675675 * are in it. */
676676 {
677 char *src, *dst;
677 const char *src;
678 char *dst;
678679 int c;
679680
680681 parseInfoPtr->wordLength = 0;
718719 parseInfoPtr->word[parseInfoPtr->wordLength] = 0;
719720 return TCL_OK;
720721 }
721
722
722723 /*
723724 *--------------------------------------------------------------
724725 *
744745 int objc, /* Number of arguments. */
745746 Tcl_Obj *const objv[]) /* Argument objects. */
746747 {
747 static const char *bmapOptions[] = {"cget", "configure", NULL};
748 static const char *const bmapOptions[] = {"cget", "configure", NULL};
748749 BitmapMaster *masterPtr = clientData;
749750 int index;
750751
781782 return TCL_OK;
782783 }
783784 }
784
785
785786 /*
786787 *----------------------------------------------------------------------
787788 *
852853
853854 return instancePtr;
854855 }
855
856
856857 /*
857858 *----------------------------------------------------------------------
858859 *
912913 XSetClipOrigin(display, instancePtr->gc, 0, 0);
913914 }
914915 }
915
916
916917 /*
917918 *----------------------------------------------------------------------
918919 *
975976 }
976977 ckfree((char *) instancePtr);
977978 }
978
979
979980 /*
980981 *----------------------------------------------------------------------
981982 *
10161017 Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
10171018 ckfree((char *) masterPtr);
10181019 }
1019
1020
10201021 /*
10211022 *----------------------------------------------------------------------
10221023 *
10461047 Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
10471048 }
10481049 }
1049
1050
10501051 /*
10511052 *----------------------------------------------------------------------
10521053 *
10781079 }
10791080 }
10801081
1081
1082
10821083 /*
10831084 *----------------------------------------------------------------------
10841085 *
11741175 Tcl_AppendResult(interp, ">} imagemask \n", NULL);
11751176 return TCL_OK;
11761177 }
1177
1178
11781179 /*
11791180 *----------------------------------------------------------------------
11801181 *
12811282 }
12821283 return TCL_OK;
12831284 }
1284
1285
12851286 /*
12861287 * Local Variables:
12871288 * mode: c
3131 * This file also contains code from miGIF. See lower down in file for the
3232 * applicable copyright notice for that portion.
3333 *
34 * RCS: @(#) $Id: tkImgGIF.c,v 1.44 2008/04/27 22:38:56 dkf Exp $
34 * RCS: @(#) $Id: tkImgGIF.c,v 1.45 2008/10/17 23:18:37 nijtmans Exp $
3535 */
3636
3737 #include "tkInt.h"
263263 int bitPixel;
264264 unsigned char colorMap[MAXCOLORMAPSIZE][4];
265265 int transparent = -1;
266 static const char *optionStrings[] = {
266 static const char *const optionStrings[] = {
267267 "-index", NULL
268268 };
269269 GIFImageConfig gifConf, *gifConfPtr = &gifConf;
1616 * Department of Computer Science,
1717 * Australian National University.
1818 *
19 * RCS: @(#) $Id: tkImgPhoto.c,v 1.82 2008/10/05 18:22:21 dkf Exp $
19 * RCS: @(#) $Id: tkImgPhoto.c,v 1.88 2008/11/18 23:49:43 nijtmans Exp $
2020 */
2121
2222 #include "tkImgPhoto.h"
7676 * of the OPT_* constants above.
7777 */
7878
79 static char *optionNames[] = {
79 static const char *const optionNames[] = {
8080 "-background",
8181 "-compositingrule",
8282 "-format",
101101 * Functions used in the type record for photo images.
102102 */
103103
104 static int ImgPhotoCreate(Tcl_Interp *interp, char *name,
104 static int ImgPhotoCreate(Tcl_Interp *interp, const char *name,
105105 int objc, Tcl_Obj *const objv[],
106 Tk_ImageType *typePtr, Tk_ImageMaster master,
106 const Tk_ImageType *typePtr, Tk_ImageMaster master,
107107 ClientData *clientDataPtr);
108108 static void ImgPhotoDelete(ClientData clientData);
109109 static int ImgPhotoPostscript(ClientData clientData,
134134 /* Pointer to the first in the list of known
135135 * photo image formats.*/
136136 int initialized; /* Set to 1 if we've initialized the
137 * strucuture. */
137 * structure. */
138138 } ThreadSpecificData;
139139 static Tcl_ThreadDataKey dataKey;
140140
228228 while (tsdPtr->oldFormatList != NULL) {
229229 freePtr = tsdPtr->oldFormatList;
230230 tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr;
231 ckfree(freePtr->name);
232231 ckfree((char *) freePtr);
233232 }
234233 while (tsdPtr->formatList != NULL) {
235234 freePtr = tsdPtr->formatList;
236235 tsdPtr->formatList = tsdPtr->formatList->nextPtr;
237 ckfree(freePtr->name);
238236 ckfree((char *) freePtr);
239237 }
240238 }
260258
261259 void
262260 Tk_CreateOldPhotoImageFormat(
263 Tk_PhotoImageFormat *formatPtr)
261 const Tk_PhotoImageFormat *formatPtr)
264262 /* Structure describing the format. All of the
265263 * fields except "nextPtr" must be filled in
266 * by caller. Must not have been passed to
267 * Tk_CreatePhotoImageFormat previously. */
264 * by caller. */
268265 {
269266 Tk_PhotoImageFormat *copyPtr;
270267 ThreadSpecificData *tsdPtr =
276273 }
277274 copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
278275 *copyPtr = *formatPtr;
279 copyPtr->name = ckalloc((unsigned) (strlen(formatPtr->name) + 1));
280 strcpy(copyPtr->name, formatPtr->name);
281276 copyPtr->nextPtr = tsdPtr->oldFormatList;
282277 tsdPtr->oldFormatList = copyPtr;
283278 }
284279
285280 void
286281 Tk_CreatePhotoImageFormat(
287 Tk_PhotoImageFormat *formatPtr)
282 const Tk_PhotoImageFormat *formatPtr)
288283 /* Structure describing the format. All of the
289284 * fields except "nextPtr" must be filled in
290 * by caller. Must not have been passed to
291 * Tk_CreatePhotoImageFormat previously. */
285 * by caller. */
292286 {
293287 Tk_PhotoImageFormat *copyPtr;
294288 ThreadSpecificData *tsdPtr =
300294 }
301295 copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
302296 *copyPtr = *formatPtr;
303 copyPtr->name = ckalloc((unsigned) (strlen(formatPtr->name) + 1));
304 strcpy(copyPtr->name, formatPtr->name);
305297 if (isupper((unsigned char) *formatPtr->name)) {
306298 copyPtr->nextPtr = tsdPtr->oldFormatList;
307299 tsdPtr->oldFormatList = copyPtr;
332324 ImgPhotoCreate(
333325 Tcl_Interp *interp, /* Interpreter for application containing
334326 * image. */
335 char *name, /* Name to use for image. */
327 const char *name, /* Name to use for image. */
336328 int objc, /* Number of arguments. */
337329 Tcl_Obj *const objv[], /* Argument objects for options (doesn't
338330 * include image name or type). */
339 Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
331 const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
340332 Tk_ImageMaster master, /* Token for image, to be used by us in later
341333 * callbacks. */
342334 ClientData *clientDataPtr) /* Store manager's token for image here; it
397389 int objc, /* Number of arguments. */
398390 Tcl_Obj *const objv[]) /* Argument objects. */
399391 {
400 static const char *photoOptions[] = {
392 static const char *const photoOptions[] = {
401393 "blank", "cget", "configure", "copy", "data", "get", "put",
402394 "read", "redither", "transparency", "write", NULL
403395 };
11241116 return TCL_OK;
11251117
11261118 case PHOTO_TRANS: {
1127 static const char *photoTransOptions[] = {
1119 static const char *const photoTransOptions[] = {
11281120 "get", "set", NULL
11291121 };
11301122 enum transOptions {
14001392 {
14011393 int index, c, bit, currentBit, length;
14021394 int values[4], numValues, maxValues, argIndex;
1403 char *option, **listPtr;
1395 const char *option;
1396 const char *const *listPtr;
14041397
14051398 for (index = *optIndexPtr; index < objc; *optIndexPtr = ++index) {
14061399 /*
15091502 * constants.
15101503 */
15111504
1512 static const char *compositingRules[] = {
1505 static const char *const compositingRules[] = {
15131506 "overlay", "set", NULL
15141507 };
15151508
25162509 * exists. */
25172510 const char *imageName) /* Name of the desired photo image. */
25182511 {
2519 Tk_ImageType *typePtr;
2512 const Tk_ImageType *typePtr;
25202513 ClientData clientData =
25212514 Tk_GetImageMasterData(interp, imageName, &typePtr);
25222515
2523 if (typePtr != &tkPhotoImageType) {
2516 if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) {
25242517 return NULL;
25252518 }
25262519 return clientData;
99 # See the file "license.terms" for information on usage and redistribution
1010 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 #
12 # RCS: @(#) $Id: tkInt.decls,v 1.45 2008/08/19 15:52:11 georgeps Exp $
12 # RCS: @(#) $Id: tkInt.decls,v 1.51 2008/12/05 15:51:31 nijtmans Exp $
1313
1414 library tk
1515
6161 declare 11 generic {
6262 unsigned long TkCreateBindingProcedure(Tcl_Interp *interp,
6363 Tk_BindingTable bindingTable, ClientData object,
64 CONST char *eventString, TkBindEvalProc *evalProc,
64 const char *eventString, TkBindEvalProc *evalProc,
6565 TkBindFreeProc *freeProc, ClientData clientData)
6666 }
6767 declare 12 generic {
6868 TkCursor *TkCreateCursorFromData(Tk_Window tkwin,
69 CONST char *source, CONST char *mask, int width, int height,
69 const char *source, const char *mask, int width, int height,
7070 int xHot, int yHot, XColor fg, XColor bg)
7171 }
7272 declare 13 generic {
7373 int TkCreateFrame(ClientData clientData, Tcl_Interp *interp,
74 int argc, char **argv, int toplevel, char *appName)
74 int argc, const char *const *argv, int toplevel, const char *appName)
7575 }
7676 declare 14 generic {
7777 Tk_Window TkCreateMainWindow(Tcl_Interp *interp,
78 CONST char *screenName, char *baseName)
78 const char *screenName, const char *baseName)
7979 }
8080 declare 15 generic {
8181 Time TkCurrentTime(TkDisplay *dispPtr)
9898 Display *display, Drawable drawable, GC gc, GC outlineGC)
9999 }
100100 declare 21 generic {
101 int TkFindStateNum(Tcl_Interp *interp, CONST char *option,
102 CONST TkStateMap *mapPtr, CONST char *strKey)
101 int TkFindStateNum(Tcl_Interp *interp, const char *option,
102 const TkStateMap *mapPtr, const char *strKey)
103103 }
104104 declare 22 generic {
105 char *TkFindStateString(CONST TkStateMap *mapPtr, int numKey)
105 char *TkFindStateString(const TkStateMap *mapPtr, int numKey)
106106 }
107107 declare 23 generic {
108108 void TkFocusDeadWindow(TkWindow *winPtr)
128128 void TkpFreeCursor(TkCursor *cursorPtr)
129129 }
130130 declare 30 generic {
131 char *TkGetBitmapData(Tcl_Interp *interp, char *string, char *fileName,
132 int *widthPtr, int *heightPtr, int *hotXPtr, int *hotYPtr)
131 char *TkGetBitmapData(Tcl_Interp *interp, const char *string,
132 const char *fileName, int *widthPtr, int *heightPtr,
133 int *hotXPtr, int *hotYPtr)
133134 }
134135 declare 31 generic {
135136 void TkGetButtPoints(double p1[], double p2[],
140141 Tk_Window tkwin, Tk_Uid string)
141142 }
142143 declare 33 generic {
143 CONST84_RETURN char *TkGetDefaultScreenName(Tcl_Interp *interp,
144 CONST char *screenName)
144 const char *TkGetDefaultScreenName(Tcl_Interp *interp,
145 const char *screenName)
145146 }
146147 declare 34 generic {
147148 TkDisplay *TkGetDisplay(Display *display)
148149 }
149150 declare 35 generic {
150 int TkGetDisplayOf(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[],
151 int TkGetDisplayOf(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[],
151152 Tk_Window *tkwinPtr)
152153 }
153154 declare 36 generic {
223224 void TkpClaimFocus(TkWindow *topLevelPtr, int force)
224225 }
225226 declare 58 generic {
226 void TkpDisplayWarning(CONST char *msg, CONST char *title)
227 void TkpDisplayWarning(const char *msg, const char *title)
227228 }
228229 declare 59 generic {
229230 void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name)
254255 void TkpMenuNotifyToplevelCreate(Tcl_Interp *interp1, char *menuName)
255256 }
256257 declare 68 generic {
257 TkDisplay *TkpOpenDisplay(CONST char *display_name)
258 TkDisplay *TkpOpenDisplay(const char *display_name)
258259 }
259260 declare 69 generic {
260261 int TkPointerEvent(XEvent *eventPtr, TkWindow *winPtr)
275276 void TkpSetMainMenubar(Tcl_Interp *interp, Tk_Window tkwin, char *menuName)
276277 }
277278 declare 75 generic {
278 int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, CONST char *string)
279 int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, const char *string)
279280 }
280281 declare 77 generic {
281282 void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr)
282283 }
283284 declare 78 generic {
284 int TkReadBitmapFile(Display *display, Drawable d, CONST char *filename,
285 int TkReadBitmapFile(Display *display, Drawable d, const char *filename,
285286 unsigned int *width_return, unsigned int *height_return,
286287 Pixmap *bitmap_return, int *x_hot_return, int *y_hot_return)
287288 }
373374 }
374375 declare 104 generic {
375376 int TkFindStateNumObj(Tcl_Interp *interp, Tcl_Obj *optionPtr,
376 CONST TkStateMap *mapPtr, Tcl_Obj *keyPtr)
377 const TkStateMap *mapPtr, Tcl_Obj *keyPtr)
377378 }
378379 declare 105 generic {
379380 Tcl_HashTable *TkGetBitmapPredefTable(void)
396397 }
397398 declare 111 generic {
398399 Tcl_Obj *TkpGetSystemDefault(Tk_Window tkwin,
399 CONST char *dbName, CONST char *className)
400 const char *dbName, const char *className)
400401 }
401402 declare 112 generic {
402403 void TkpMenuThreadInit(void)
425426 TkRegion src, TkRegion dr_return)
426427 }
427428 declare 121 aqua {
428 Pixmap TkpCreateNativeBitmap(Display *display, CONST char *source)
429 Pixmap TkpCreateNativeBitmap(Display *display, const char *source)
429430 }
430431 declare 122 aqua {
431432 void TkpDefineNativeBitmaps(void)
432433 }
433434 declare 124 aqua {
434435 Pixmap TkpGetNativeAppBitmap(Display *display,
435 CONST char *name, int *width, int *height)
436 const char *name, int *width, int *height)
436437 }
437438 declare 135 generic {
438439 void TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC, GC bgGC,
477478 }
478479 declare 148 generic {
479480 Tk_Window TkToplevelWindowForCommand(Tcl_Interp *interp,
480 CONST char *cmdName)
481 const char *cmdName)
481482 }
482483 declare 149 generic {
483 CONST Tk_OptionSpec *TkGetOptionSpec(CONST char *name,
484 const Tk_OptionSpec *TkGetOptionSpec(const char *name,
484485 Tk_OptionTable optionTable)
485486 }
486487
507508 # entries needed only by tktest:
508509 declare 156 generic {
509510 int TkpTestembedCmd(ClientData clientData, Tcl_Interp *interp, int argc,
510 CONST char **argv)
511 const char **argv)
511512 }
512513 declare 157 generic {
513514 int TkpTesttextCmd(ClientData dummy, Tcl_Interp *interp, int argc,
514 CONST char **argv)
515 const char **argv)
516 }
517 declare 158 generic {
518 int TkSelGetSelection(Tcl_Interp *interp, Tk_Window tkwin,
519 Atom selection, Atom target, Tk_GetSelProc *proc,
520 ClientData clientData)
521 }
522 declare 159 generic {
523 int TkTextGetIndex(Tcl_Interp *interp, struct TkText *textPtr,
524 const char *string, struct TkTextIndex *indexPtr)
525 }
526 declare 160 generic {
527 int TkTextIndexBackBytes(const struct TkText *textPtr,
528 const struct TkTextIndex *srcPtr, int count,
529 struct TkTextIndex *dstPtr)
530 }
531 declare 161 generic {
532 int TkTextIndexForwBytes(const struct TkText *textPtr,
533 const struct TkTextIndex *srcPtr, int count,
534 struct TkTextIndex *dstPtr)
535 }
536 declare 162 generic {
537 struct TkTextIndex *TkTextMakeByteIndex(TkTextBTree tree,
538 const struct TkText *textPtr, int lineIndex,
539 int byteIndex, struct TkTextIndex *indexPtr)
540 }
541 declare 163 generic {
542 int TkTextPrintIndex(const struct TkText *textPtr,
543 const struct TkTextIndex *indexPtr, char *string)
544 }
545 declare 164 generic {
546 struct TkTextSegment *TkTextSetMark(struct TkText *textPtr,
547 const char *name, struct TkTextIndex *indexPtr)
548 }
549 declare 165 generic {
550 int TkTextXviewCmd(struct TkText *textPtr, Tcl_Interp *interp,
551 int objc, Tcl_Obj *const objv[])
552 }
553 declare 166 generic {
554 void TkTextChanged(struct TkSharedText *sharedTextPtr,
555 struct TkText *textPtr, const struct TkTextIndex *index1Ptr,
556 const struct TkTextIndex *index2Ptr)
557 }
558 declare 167 generic {
559 int TkBTreeNumLines(TkTextBTree tree,
560 const struct TkText *textPtr)
561 }
562 declare 168 generic {
563 void TkTextInsertDisplayProc(struct TkText *textPtr,
564 struct TkTextDispChunk *chunkPtr, int x, int y,
565 int height, int baseline, Display *display,
566 Drawable dst, int screenY)
515567 }
516568
517569 ##############################################################################
543595 void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar)
544596 }
545597 declare 8 x11 {
546 int TkpScanWindowId(Tcl_Interp *interp, CONST char *string, Window *idPtr)
598 int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr)
547599 }
548600 declare 9 x11 {
549601 void TkWmCleanup(TkDisplay *dispPtr)
557609 # only needed by tktest:
558610 declare 13 x11 {
559611 int TkpTestsendCmd(ClientData clientData, Tcl_Interp *interp, int argc,
560 CONST char **argv)
612 const char **argv)
561613 }
562614
563615 ################################
579631 void TkpPrintWindowId(char *buf, Window window)
580632 }
581633 declare 6 win {
582 int TkpScanWindowId(Tcl_Interp *interp, CONST char *string, Window *idPtr)
634 int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr)
583635 }
584636 declare 7 win {
585637 void TkpSetCapture(TkWindow *winPtr)
664716 }
665717 declare 32 win {
666718 Tcl_Obj *TkWinGetMenuSystemDefault(Tk_Window tkwin,
667 CONST char *dbName, CONST char *className)
719 const char *dbName, const char *className)
668720 }
669721 declare 33 win {
670722 int TkWinGetPlatformId(void)
688740
689741 # removed duplicates from tkInt table
690742 #declare 1 aqua {
691 # Pixmap TkpCreateNativeBitmap(Display *display, CONST char *source)
743 # Pixmap TkpCreateNativeBitmap(Display *display, const char *source)
692744 #}
693745 #
694746 #declare 2 aqua {
10891141 Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x)
10901142 }
10911143 declare 62 win {
1092 void XSetCommand(Display *d, Window w, CONST char **c, int i)
1144 void XSetCommand(Display *d, Window w, const char **c, int i)
10931145 }
10941146 declare 63 win {
10951147 void XSetIconName(Display *d, Window w, _Xconst char *c)
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: $Id: tkInt.h,v 1.83 2008/04/02 21:32:32 das Exp $
13 * RCS: $Id: tkInt.h,v 1.98 2008/12/10 05:02:51 das Exp $
1414 */
1515
1616 #ifndef _TKINT
101101 typedef struct TkRegion_ *TkRegion;
102102 typedef struct TkStressedCmap TkStressedCmap;
103103 typedef struct TkBindInfo_ *TkBindInfo;
104 typedef struct Busy *TkBusy;
104105
105106 /*
106107 * Function types.
669670 * ::tk::AlwaysShowSelection variable. */
670671 struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
671672 * this process. */
673 Tcl_HashTable busyTable; /* Information used by [tk busy] command. */
672674 } TkMainInfo;
673675
674676 /*
851853 } TkWindow;
852854
853855 /*
856 * The following structure is used with TkMakeEnsemble to create
857 * ensemble commands and optionally to create sub-ensembles.
858 */
859
860 typedef struct TkEnsemble {
861 const char *name;
862 Tcl_ObjCmdProc *proc;
863 const struct TkEnsemble *subensemble;
864 } TkEnsemble;
865
866 /*
854867 * The following structure is used as a two way map between integers and
855868 * strings, usually to map between an internal C representation and the
856869 * strings used in Tcl.
930943 * be properly registered with Tcl:
931944 */
932945
933 MODULE_SCOPE Tcl_ObjType tkBorderObjType;
934 MODULE_SCOPE Tcl_ObjType tkBitmapObjType;
935 MODULE_SCOPE Tcl_ObjType tkColorObjType;
936 MODULE_SCOPE Tcl_ObjType tkCursorObjType;
937 MODULE_SCOPE Tcl_ObjType tkFontObjType;
938 MODULE_SCOPE Tcl_ObjType tkOptionObjType;
939 MODULE_SCOPE Tcl_ObjType tkStateKeyObjType;
940 MODULE_SCOPE Tcl_ObjType tkTextIndexType;
946 MODULE_SCOPE const Tcl_ObjType tkBorderObjType;
947 MODULE_SCOPE const Tcl_ObjType tkBitmapObjType;
948 MODULE_SCOPE const Tcl_ObjType tkColorObjType;
949 MODULE_SCOPE const Tcl_ObjType tkCursorObjType;
950 MODULE_SCOPE const Tcl_ObjType tkFontObjType;
951 MODULE_SCOPE const Tcl_ObjType tkOptionObjType;
952 MODULE_SCOPE const Tcl_ObjType tkStateKeyObjType;
953 MODULE_SCOPE const Tcl_ObjType tkTextIndexType;
941954
942955 /*
943956 * Miscellaneous variables shared among Tk modules but not exported to the
944957 * outside world:
945958 */
946959
947 MODULE_SCOPE Tk_SmoothMethod tkBezierSmoothMethod;
960 MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod;
948961 MODULE_SCOPE Tk_ImageType tkBitmapImageType;
949962 MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF;
950963 MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr);
953966 MODULE_SCOPE Tk_ImageType tkPhotoImageType;
954967 MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable;
955968
969 /*
970 * The definition of pi, at least from the perspective of double-precision
971 * floats.
972 */
973
974 #ifndef PI
975 #ifdef M_PI
976 #define PI M_PI
977 #else
978 #define PI 3.14159265358979323846
979 #endif
980 #endif
981
982 /*
983 * The following magic value is stored in the "send_event" field of FocusIn
984 * and FocusOut events. This allows us to separate "real" events coming from
985 * the server from those that we generated.
986 */
987
988 #define GENERATED_FOCUS_EVENT_MAGIC ((Bool) 0x547321ac)
989
990 /*
991 * Exported internals.
992 */
993
956994 #include "tkIntDecls.h"
957995
958996 #ifdef BUILD_tk
9801018 MODULE_SCOPE int Tk_BindtagsObjCmd(ClientData clientData,
9811019 Tcl_Interp *interp, int objc,
9821020 Tcl_Obj *const objv[]);
1021 MODULE_SCOPE int Tk_BusyObjCmd(ClientData clientData,
1022 Tcl_Interp *interp, int objc,
1023 Tcl_Obj *const objv[]);
9831024 MODULE_SCOPE int Tk_ButtonObjCmd(ClientData clientData,
9841025 Tcl_Interp *interp, int objc,
9851026 Tcl_Obj *const objv[]);
9961037 Tcl_Interp *interp, int objc,
9971038 Tcl_Obj *const objv[]);
9981039 MODULE_SCOPE int Tk_ChooseDirectoryObjCmd(ClientData clientData,
999 Tcl_Interp *interp, int objc,
1000 Tcl_Obj *const objv[]);
1001 MODULE_SCOPE int Tk_ChooseFontObjCmd(ClientData clientData,
10021040 Tcl_Interp *interp, int objc,
10031041 Tcl_Obj *const objv[]);
10041042 MODULE_SCOPE int Tk_DestroyObjCmd(ClientData clientData,
10921130 MODULE_SCOPE int Tk_TextObjCmd(ClientData clientData,
10931131 Tcl_Interp *interp, int objc,
10941132 Tcl_Obj *const objv[]);
1095 MODULE_SCOPE int Tk_TkObjCmd(ClientData clientData,
1096 Tcl_Interp *interp, int objc,
1097 Tcl_Obj *const objv[]);
10981133 MODULE_SCOPE int Tk_TkwaitObjCmd(ClientData clientData,
10991134 Tcl_Interp *interp, int objc,
11001135 Tcl_Obj *const objv[]);
11091144 Tcl_Obj *const objv[]);
11101145 MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
11111146 int objc, Tcl_Obj *const objv[]);
1147
1148 MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
1149 Tk_Window tkwin,
1150 Tcl_Obj *objPtr,
1151 double *doublePtr);
11121152
11131153 MODULE_SCOPE void TkEventInit(void);
11141154 MODULE_SCOPE void TkRegisterObjTypes(void);
11211161 MODULE_SCOPE int TkCanvasDashParseProc(ClientData clientData,
11221162 Tcl_Interp *interp, Tk_Window tkwin,
11231163 const char *value, char *widgRec, int offset);
1124 MODULE_SCOPE char * TkCanvasDashPrintProc(ClientData clientData,
1164 MODULE_SCOPE const char * TkCanvasDashPrintProc(ClientData clientData,
11251165 Tk_Window tkwin, char *widgRec, int offset,
11261166 Tcl_FreeProc **freeProcPtr);
11271167 MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin,
11291169 MODULE_SCOPE int TkOffsetParseProc(ClientData clientData,
11301170 Tcl_Interp *interp, Tk_Window tkwin,
11311171 const char *value, char *widgRec, int offset);
1132 MODULE_SCOPE char * TkOffsetPrintProc(ClientData clientData,
1172 MODULE_SCOPE const char * TkOffsetPrintProc(ClientData clientData,
11331173 Tk_Window tkwin, char *widgRec, int offset,
11341174 Tcl_FreeProc **freeProcPtr);
11351175 MODULE_SCOPE int TkOrientParseProc(ClientData clientData,
11361176 Tcl_Interp *interp, Tk_Window tkwin,
11371177 const char *value, char *widgRec, int offset);
1138 MODULE_SCOPE char * TkOrientPrintProc(ClientData clientData,
1178 MODULE_SCOPE const char * TkOrientPrintProc(ClientData clientData,
11391179 Tk_Window tkwin, char *widgRec, int offset,
11401180 Tcl_FreeProc **freeProcPtr);
11411181 MODULE_SCOPE int TkPixelParseProc(ClientData clientData,
11421182 Tcl_Interp *interp, Tk_Window tkwin,
11431183 const char *value, char *widgRec, int offset);
1144 MODULE_SCOPE char * TkPixelPrintProc(ClientData clientData,
1184 MODULE_SCOPE const char * TkPixelPrintProc(ClientData clientData,
11451185 Tk_Window tkwin, char *widgRec, int offset,
11461186 Tcl_FreeProc **freeProcPtr);
11471187 MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin,
11501190 MODULE_SCOPE int TkSmoothParseProc(ClientData clientData,
11511191 Tcl_Interp *interp, Tk_Window tkwin,
11521192 const char *value, char *recordPtr, int offset);
1153 MODULE_SCOPE char * TkSmoothPrintProc(ClientData clientData,
1193 MODULE_SCOPE const char * TkSmoothPrintProc(ClientData clientData,
11541194 Tk_Window tkwin, char *recordPtr, int offset,
11551195 Tcl_FreeProc **freeProcPtr);
11561196 MODULE_SCOPE int TkStateParseProc(ClientData clientData,
11571197 Tcl_Interp *interp, Tk_Window tkwin,
11581198 const char *value, char *widgRec, int offset);
1159 MODULE_SCOPE char * TkStatePrintProc(ClientData clientData,
1199 MODULE_SCOPE const char * TkStatePrintProc(ClientData clientData,
11601200 Tk_Window tkwin, char *widgRec, int offset,
11611201 Tcl_FreeProc **freeProcPtr);
11621202 MODULE_SCOPE int TkTileParseProc(ClientData clientData,
11631203 Tcl_Interp *interp, Tk_Window tkwin,
11641204 const char *value, char *widgRec, int offset);
1165 MODULE_SCOPE char * TkTilePrintProc(ClientData clientData, Tk_Window tkwin,
1205 MODULE_SCOPE const char * TkTilePrintProc(ClientData clientData, Tk_Window tkwin,
11661206 char *widgRec, int offset,
11671207 Tcl_FreeProc **freeProcPtr);
11681208 MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin);
11781218 unsigned height, unsigned char *dataPtr,
11791219 unsigned pixelStride, unsigned lineStride);
11801220 MODULE_SCOPE void TkPrintPadAmount(Tcl_Interp *interp,
1181 char *buffer, int pad1, int pad2);
1221 const char *buffer, int pad1, int pad2);
11821222 MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp,
11831223 Tk_Window tkwin, Tcl_Obj *objPtr,
11841224 int *pad1Ptr, int *pad2Ptr);
11991239 int firstByte, int lastByte);
12001240 MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
12011241 Tcl_UniChar c, struct TkFontAttributes *faPtr);
1242 MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin);
1243 MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy);
1244 MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy);
1245 MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin,
1246 Window parent);
1247 MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
1248 Window *parentPtr, Tk_Window tkParent,
1249 TkBusy busy);
1250 MODULE_SCOPE void TkDrawAngledTextLayout(Display *display,
1251 Drawable drawable, GC gc, Tk_TextLayout layout,
1252 int x, int y, double angle, int firstChar,
1253 int lastChar);
1254 MODULE_SCOPE void TkpDrawAngledChars(Display *display,Drawable drawable,
1255 GC gc, Tk_Font tkfont, const char *source,
1256 int numBytes, double x, double y, double angle);
1257 MODULE_SCOPE void TkUnderlineAngledTextLayout(Display *display,
1258 Drawable drawable, GC gc, Tk_TextLayout layout,
1259 int x, int y, double angle, int underline);
1260 MODULE_SCOPE int TkIntersectAngledTextLayout(Tk_TextLayout layout,
1261 int x,int y, int width, int height, double angle);
1262 MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp,
1263 int objc, Tcl_Obj *const *objv, int flags);
1264 MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin, const char *eventName);
1265 MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp,
1266 const char *namespace, const char *name,
1267 ClientData clientData, const TkEnsemble *map);
1268 MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp,
1269 ClientData clientData);
1270 MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp,
1271 ClientData clientData);
12021272
12031273 /*
12041274 * Unsupported commands.
1010 * See the file "license.terms" for information on usage and redistribution
1111 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkIntDecls.h,v 1.35 2008/08/19 15:52:11 georgeps Exp $
13 * RCS: @(#) $Id: tkIntDecls.h,v 1.41 2008/12/05 15:51:31 nijtmans Exp $
1414 */
1515
1616 #ifndef _TKINTDECLS
2020 #undef TCL_STORAGE_CLASS
2121 #define TCL_STORAGE_CLASS DLLEXPORT
2222 #endif
23
24 struct TkText;
25 typedef struct TkTextBTree_ *TkTextBTree;
26 struct TkTextDispChunk;
27 struct TkTextIndex;
28 struct TkTextSegment;
29 struct TkSharedText;
2330
2431 /*
2532 * WARNING: This file is automatically generated by the tools/genStubs.tcl
3643 #ifndef TkAllocWindow_TCL_DECLARED
3744 #define TkAllocWindow_TCL_DECLARED
3845 /* 0 */
39 EXTERN TkWindow * TkAllocWindow (TkDisplay * dispPtr, int screenNum,
46 EXTERN TkWindow * TkAllocWindow (TkDisplay * dispPtr, int screenNum,
4047 TkWindow * parentPtr);
4148 #endif
4249 #ifndef TkBezierPoints_TCL_DECLARED
4350 #define TkBezierPoints_TCL_DECLARED
4451 /* 1 */
45 EXTERN void TkBezierPoints (double control[], int numSteps,
52 EXTERN void TkBezierPoints (double control[], int numSteps,
4653 double * coordPtr);
4754 #endif
4855 #ifndef TkBezierScreenPoints_TCL_DECLARED
4956 #define TkBezierScreenPoints_TCL_DECLARED
5057 /* 2 */
51 EXTERN void TkBezierScreenPoints (Tk_Canvas canvas,
52 double control[], int numSteps,
58 EXTERN void TkBezierScreenPoints (Tk_Canvas canvas,
59 double control[], int numSteps,
5360 XPoint * xPointPtr);
5461 #endif
5562 #ifndef TkBindDeadWindow_TCL_DECLARED
6067 #ifndef TkBindEventProc_TCL_DECLARED
6168 #define TkBindEventProc_TCL_DECLARED
6269 /* 4 */
63 EXTERN void TkBindEventProc (TkWindow * winPtr,
70 EXTERN void TkBindEventProc (TkWindow * winPtr,
6471 XEvent * eventPtr);
6572 #endif
6673 #ifndef TkBindFree_TCL_DECLARED
7683 #ifndef TkChangeEventWindow_TCL_DECLARED
7784 #define TkChangeEventWindow_TCL_DECLARED
7885 /* 7 */
79 EXTERN void TkChangeEventWindow (XEvent * eventPtr,
86 EXTERN void TkChangeEventWindow (XEvent * eventPtr,
8087 TkWindow * winPtr);
8188 #endif
8289 #ifndef TkClipInit_TCL_DECLARED
8794 #ifndef TkComputeAnchor_TCL_DECLARED
8895 #define TkComputeAnchor_TCL_DECLARED
8996 /* 9 */
90 EXTERN void TkComputeAnchor (Tk_Anchor anchor, Tk_Window tkwin,
91 int padX, int padY, int innerWidth,
97 EXTERN void TkComputeAnchor (Tk_Anchor anchor, Tk_Window tkwin,
98 int padX, int padY, int innerWidth,
9299 int innerHeight, int * xPtr, int * yPtr);
93100 #endif
94101 #ifndef TkCopyAndGlobalEval_TCL_DECLARED
95102 #define TkCopyAndGlobalEval_TCL_DECLARED
96103 /* 10 */
97 EXTERN int TkCopyAndGlobalEval (Tcl_Interp * interp,
104 EXTERN int TkCopyAndGlobalEval (Tcl_Interp * interp,
98105 char * script);
99106 #endif
100107 #ifndef TkCreateBindingProcedure_TCL_DECLARED
101108 #define TkCreateBindingProcedure_TCL_DECLARED
102109 /* 11 */
103 EXTERN unsigned long TkCreateBindingProcedure (Tcl_Interp * interp,
104 Tk_BindingTable bindingTable,
105 ClientData object, CONST char * eventString,
106 TkBindEvalProc * evalProc,
107 TkBindFreeProc * freeProc,
110 EXTERN unsigned long TkCreateBindingProcedure (Tcl_Interp * interp,
111 Tk_BindingTable bindingTable,
112 ClientData object, const char * eventString,
113 TkBindEvalProc * evalProc,
114 TkBindFreeProc * freeProc,
108115 ClientData clientData);
109116 #endif
110117 #ifndef TkCreateCursorFromData_TCL_DECLARED
111118 #define TkCreateCursorFromData_TCL_DECLARED
112119 /* 12 */
113 EXTERN TkCursor * TkCreateCursorFromData (Tk_Window tkwin,
114 CONST char * source, CONST char * mask,
115 int width, int height, int xHot, int yHot,
120 EXTERN TkCursor * TkCreateCursorFromData (Tk_Window tkwin,
121 const char * source, const char * mask,
122 int width, int height, int xHot, int yHot,
116123 XColor fg, XColor bg);
117124 #endif
118125 #ifndef TkCreateFrame_TCL_DECLARED
119126 #define TkCreateFrame_TCL_DECLARED
120127 /* 13 */
121 EXTERN int TkCreateFrame (ClientData clientData,
122 Tcl_Interp * interp, int argc, char ** argv,
123 int toplevel, char * appName);
128 EXTERN int TkCreateFrame (ClientData clientData,
129 Tcl_Interp * interp, int argc,
130 const char *const * argv, int toplevel,
131 const char * appName);
124132 #endif
125133 #ifndef TkCreateMainWindow_TCL_DECLARED
126134 #define TkCreateMainWindow_TCL_DECLARED
127135 /* 14 */
128 EXTERN Tk_Window TkCreateMainWindow (Tcl_Interp * interp,
129 CONST char * screenName, char * baseName);
136 EXTERN Tk_Window TkCreateMainWindow (Tcl_Interp * interp,
137 const char * screenName,
138 const char * baseName);
130139 #endif
131140 #ifndef TkCurrentTime_TCL_DECLARED
132141 #define TkCurrentTime_TCL_DECLARED
146155 #ifndef TkDrawInsetFocusHighlight_TCL_DECLARED
147156 #define TkDrawInsetFocusHighlight_TCL_DECLARED
148157 /* 18 */
149 EXTERN void TkDrawInsetFocusHighlight (Tk_Window tkwin, GC gc,
158 EXTERN void TkDrawInsetFocusHighlight (Tk_Window tkwin, GC gc,
150159 int width, Drawable drawable, int padding);
151160 #endif
152161 #ifndef TkEventDeadWindow_TCL_DECLARED
157166 #ifndef TkFillPolygon_TCL_DECLARED
158167 #define TkFillPolygon_TCL_DECLARED
159168 /* 20 */
160 EXTERN void TkFillPolygon (Tk_Canvas canvas, double * coordPtr,
161 int numPoints, Display * display,
169 EXTERN void TkFillPolygon (Tk_Canvas canvas, double * coordPtr,
170 int numPoints, Display * display,
162171 Drawable drawable, GC gc, GC outlineGC);
163172 #endif
164173 #ifndef TkFindStateNum_TCL_DECLARED
165174 #define TkFindStateNum_TCL_DECLARED
166175 /* 21 */
167 EXTERN int TkFindStateNum (Tcl_Interp * interp,
168 CONST char * option,
169 CONST TkStateMap * mapPtr,
170 CONST char * strKey);
176 EXTERN int TkFindStateNum (Tcl_Interp * interp,
177 const char * option,
178 const TkStateMap * mapPtr,
179 const char * strKey);
171180 #endif
172181 #ifndef TkFindStateString_TCL_DECLARED
173182 #define TkFindStateString_TCL_DECLARED
174183 /* 22 */
175 EXTERN char * TkFindStateString (CONST TkStateMap * mapPtr,
184 EXTERN char * TkFindStateString (const TkStateMap * mapPtr,
176185 int numKey);
177186 #endif
178187 #ifndef TkFocusDeadWindow_TCL_DECLARED
183192 #ifndef TkFocusFilterEvent_TCL_DECLARED
184193 #define TkFocusFilterEvent_TCL_DECLARED
185194 /* 24 */
186 EXTERN int TkFocusFilterEvent (TkWindow * winPtr,
195 EXTERN int TkFocusFilterEvent (TkWindow * winPtr,
187196 XEvent * eventPtr);
188197 #endif
189198 #ifndef TkFocusKeyEvent_TCL_DECLARED
190199 #define TkFocusKeyEvent_TCL_DECLARED
191200 /* 25 */
192 EXTERN TkWindow * TkFocusKeyEvent (TkWindow * winPtr,
201 EXTERN TkWindow * TkFocusKeyEvent (TkWindow * winPtr,
193202 XEvent * eventPtr);
194203 #endif
195204 #ifndef TkFontPkgInit_TCL_DECLARED
215224 #ifndef TkGetBitmapData_TCL_DECLARED
216225 #define TkGetBitmapData_TCL_DECLARED
217226 /* 30 */
218 EXTERN char * TkGetBitmapData (Tcl_Interp * interp, char * string,
219 char * fileName, int * widthPtr,
220 int * heightPtr, int * hotXPtr,
221 int * hotYPtr);
227 EXTERN char * TkGetBitmapData (Tcl_Interp * interp,
228 const char * string, const char * fileName,
229 int * widthPtr, int * heightPtr,
230 int * hotXPtr, int * hotYPtr);
222231 #endif
223232 #ifndef TkGetButtPoints_TCL_DECLARED
224233 #define TkGetButtPoints_TCL_DECLARED
225234 /* 31 */
226 EXTERN void TkGetButtPoints (double p1[], double p2[],
227 double width, int project, double m1[],
235 EXTERN void TkGetButtPoints (double p1[], double p2[],
236 double width, int project, double m1[],
228237 double m2[]);
229238 #endif
230239 #ifndef TkGetCursorByName_TCL_DECLARED
231240 #define TkGetCursorByName_TCL_DECLARED
232241 /* 32 */
233 EXTERN TkCursor * TkGetCursorByName (Tcl_Interp * interp,
242 EXTERN TkCursor * TkGetCursorByName (Tcl_Interp * interp,
234243 Tk_Window tkwin, Tk_Uid string);
235244 #endif
236245 #ifndef TkGetDefaultScreenName_TCL_DECLARED
237246 #define TkGetDefaultScreenName_TCL_DECLARED
238247 /* 33 */
239 EXTERN CONST84_RETURN char * TkGetDefaultScreenName (Tcl_Interp * interp,
240 CONST char * screenName);
248 EXTERN const char * TkGetDefaultScreenName (Tcl_Interp * interp,
249 const char * screenName);
241250 #endif
242251 #ifndef TkGetDisplay_TCL_DECLARED
243252 #define TkGetDisplay_TCL_DECLARED
247256 #ifndef TkGetDisplayOf_TCL_DECLARED
248257 #define TkGetDisplayOf_TCL_DECLARED
249258 /* 35 */
250 EXTERN int TkGetDisplayOf (Tcl_Interp * interp, int objc,
251 Tcl_Obj *CONST objv[], Tk_Window * tkwinPtr);
259 EXTERN int TkGetDisplayOf (Tcl_Interp * interp, int objc,
260 Tcl_Obj *const objv[], Tk_Window * tkwinPtr);
252261 #endif
253262 #ifndef TkGetFocusWin_TCL_DECLARED
254263 #define TkGetFocusWin_TCL_DECLARED
258267 #ifndef TkGetInterpNames_TCL_DECLARED
259268 #define TkGetInterpNames_TCL_DECLARED
260269 /* 37 */
261 EXTERN int TkGetInterpNames (Tcl_Interp * interp,
270 EXTERN int TkGetInterpNames (Tcl_Interp * interp,
262271 Tk_Window tkwin);
263272 #endif
264273 #ifndef TkGetMiterPoints_TCL_DECLARED
265274 #define TkGetMiterPoints_TCL_DECLARED
266275 /* 38 */
267 EXTERN int TkGetMiterPoints (double p1[], double p2[],
268 double p3[], double width, double m1[],
276 EXTERN int TkGetMiterPoints (double p1[], double p2[],
277 double p3[], double width, double m1[],
269278 double m2[]);
270279 #endif
271280 #ifndef TkGetPointerCoords_TCL_DECLARED
272281 #define TkGetPointerCoords_TCL_DECLARED
273282 /* 39 */
274 EXTERN void TkGetPointerCoords (Tk_Window tkwin, int * xPtr,
283 EXTERN void TkGetPointerCoords (Tk_Window tkwin, int * xPtr,
275284 int * yPtr);
276285 #endif
277286 #ifndef TkGetServerInfo_TCL_DECLARED
278287 #define TkGetServerInfo_TCL_DECLARED
279288 /* 40 */
280 EXTERN void TkGetServerInfo (Tcl_Interp * interp,
289 EXTERN void TkGetServerInfo (Tcl_Interp * interp,
281290 Tk_Window tkwin);
282291 #endif
283292 #ifndef TkGrabDeadWindow_TCL_DECLARED
298307 #ifndef TkInOutEvents_TCL_DECLARED
299308 #define TkInOutEvents_TCL_DECLARED
300309 /* 44 */
301 EXTERN void TkInOutEvents (XEvent * eventPtr,
302 TkWindow * sourcePtr, TkWindow * destPtr,
303 int leaveType, int enterType,
310 EXTERN void TkInOutEvents (XEvent * eventPtr,
311 TkWindow * sourcePtr, TkWindow * destPtr,
312 int leaveType, int enterType,
304313 Tcl_QueuePosition position);
305314 #endif
306315 #ifndef TkInstallFrameMenu_TCL_DECLARED
316325 #ifndef TkLineToArea_TCL_DECLARED
317326 #define TkLineToArea_TCL_DECLARED
318327 /* 47 */
319 EXTERN int TkLineToArea (double end1Ptr[], double end2Ptr[],
328 EXTERN int TkLineToArea (double end1Ptr[], double end2Ptr[],
320329 double rectPtr[]);
321330 #endif
322331 #ifndef TkLineToPoint_TCL_DECLARED
323332 #define TkLineToPoint_TCL_DECLARED
324333 /* 48 */
325 EXTERN double TkLineToPoint (double end1Ptr[], double end2Ptr[],
334 EXTERN double TkLineToPoint (double end1Ptr[], double end2Ptr[],
326335 double pointPtr[]);
327336 #endif
328337 #ifndef TkMakeBezierCurve_TCL_DECLARED
329338 #define TkMakeBezierCurve_TCL_DECLARED
330339 /* 49 */
331 EXTERN int TkMakeBezierCurve (Tk_Canvas canvas,
332 double * pointPtr, int numPoints,
333 int numSteps, XPoint xPoints[],
340 EXTERN int TkMakeBezierCurve (Tk_Canvas canvas,
341 double * pointPtr, int numPoints,
342 int numSteps, XPoint xPoints[],
334343 double dblPoints[]);
335344 #endif
336345 #ifndef TkMakeBezierPostscript_TCL_DECLARED
337346 #define TkMakeBezierPostscript_TCL_DECLARED
338347 /* 50 */
339 EXTERN void TkMakeBezierPostscript (Tcl_Interp * interp,
340 Tk_Canvas canvas, double * pointPtr,
348 EXTERN void TkMakeBezierPostscript (Tcl_Interp * interp,
349 Tk_Canvas canvas, double * pointPtr,
341350 int numPoints);
342351 #endif
343352 #ifndef TkOptionClassChanged_TCL_DECLARED
358367 #ifndef TkOvalToPoint_TCL_DECLARED
359368 #define TkOvalToPoint_TCL_DECLARED
360369 /* 54 */
361 EXTERN double TkOvalToPoint (double ovalPtr[], double width,
370 EXTERN double TkOvalToPoint (double ovalPtr[], double width,
362371 int filled, double pointPtr[]);
363372 #endif
364373 #ifndef TkpChangeFocus_TCL_DECLARED
379388 #ifndef TkpDisplayWarning_TCL_DECLARED
380389 #define TkpDisplayWarning_TCL_DECLARED
381390 /* 58 */
382 EXTERN void TkpDisplayWarning (CONST char * msg,
383 CONST char * title);
391 EXTERN void TkpDisplayWarning (const char * msg,
392 const char * title);
384393 #endif
385394 #ifndef TkpGetAppName_TCL_DECLARED
386395 #define TkpGetAppName_TCL_DECLARED
387396 /* 59 */
388 EXTERN void TkpGetAppName (Tcl_Interp * interp,
397 EXTERN void TkpGetAppName (Tcl_Interp * interp,
389398 Tcl_DString * name);
390399 #endif
391400 #ifndef TkpGetOtherWindow_TCL_DECLARED
406415 #ifndef TkpInitializeMenuBindings_TCL_DECLARED
407416 #define TkpInitializeMenuBindings_TCL_DECLARED
408417 /* 63 */
409 EXTERN void TkpInitializeMenuBindings (Tcl_Interp * interp,
418 EXTERN void TkpInitializeMenuBindings (Tcl_Interp * interp,
410419 Tk_BindingTable bindingTable);
411420 #endif
412421 #ifndef TkpMakeContainer_TCL_DECLARED
427436 #ifndef TkpMenuNotifyToplevelCreate_TCL_DECLARED
428437 #define TkpMenuNotifyToplevelCreate_TCL_DECLARED
429438 /* 67 */
430 EXTERN void TkpMenuNotifyToplevelCreate (Tcl_Interp * interp1,
439 EXTERN void TkpMenuNotifyToplevelCreate (Tcl_Interp * interp1,
431440 char * menuName);
432441 #endif
433442 #ifndef TkpOpenDisplay_TCL_DECLARED
434443 #define TkpOpenDisplay_TCL_DECLARED
435444 /* 68 */
436 EXTERN TkDisplay * TkpOpenDisplay (CONST char * display_name);
445 EXTERN TkDisplay * TkpOpenDisplay (const char * display_name);
437446 #endif
438447 #ifndef TkPointerEvent_TCL_DECLARED
439448 #define TkPointerEvent_TCL_DECLARED
443452 #ifndef TkPolygonToArea_TCL_DECLARED
444453 #define TkPolygonToArea_TCL_DECLARED
445454 /* 70 */
446 EXTERN int TkPolygonToArea (double * polyPtr, int numPoints,
455 EXTERN int TkPolygonToArea (double * polyPtr, int numPoints,
447456 double * rectPtr);
448457 #endif
449458 #ifndef TkPolygonToPoint_TCL_DECLARED
450459 #define TkPolygonToPoint_TCL_DECLARED
451460 /* 71 */
452 EXTERN double TkPolygonToPoint (double * polyPtr, int numPoints,
461 EXTERN double TkPolygonToPoint (double * polyPtr, int numPoints,
453462 double * pointPtr);
454463 #endif
455464 #ifndef TkPositionInTree_TCL_DECLARED
456465 #define TkPositionInTree_TCL_DECLARED
457466 /* 72 */
458 EXTERN int TkPositionInTree (TkWindow * winPtr,
467 EXTERN int TkPositionInTree (TkWindow * winPtr,
459468 TkWindow * treePtr);
460469 #endif
461470 #ifndef TkpRedirectKeyEvent_TCL_DECLARED
462471 #define TkpRedirectKeyEvent_TCL_DECLARED
463472 /* 73 */
464 EXTERN void TkpRedirectKeyEvent (TkWindow * winPtr,
473 EXTERN void TkpRedirectKeyEvent (TkWindow * winPtr,
465474 XEvent * eventPtr);
466475 #endif
467476 #ifndef TkpSetMainMenubar_TCL_DECLARED
468477 #define TkpSetMainMenubar_TCL_DECLARED
469478 /* 74 */
470 EXTERN void TkpSetMainMenubar (Tcl_Interp * interp,
479 EXTERN void TkpSetMainMenubar (Tcl_Interp * interp,
471480 Tk_Window tkwin, char * menuName);
472481 #endif
473482 #ifndef TkpUseWindow_TCL_DECLARED
474483 #define TkpUseWindow_TCL_DECLARED
475484 /* 75 */
476 EXTERN int TkpUseWindow (Tcl_Interp * interp, Tk_Window tkwin,
477 CONST char * string);
485 EXTERN int TkpUseWindow (Tcl_Interp * interp, Tk_Window tkwin,
486 const char * string);
478487 #endif
479488 /* Slot 76 is reserved */
480489 #ifndef TkQueueEventForAllChildren_TCL_DECLARED
481490 #define TkQueueEventForAllChildren_TCL_DECLARED
482491 /* 77 */
483 EXTERN void TkQueueEventForAllChildren (TkWindow * winPtr,
492 EXTERN void TkQueueEventForAllChildren (TkWindow * winPtr,
484493 XEvent * eventPtr);
485494 #endif
486495 #ifndef TkReadBitmapFile_TCL_DECLARED
487496 #define TkReadBitmapFile_TCL_DECLARED
488497 /* 78 */
489 EXTERN int TkReadBitmapFile (Display * display, Drawable d,
490 CONST char * filename,
491 unsigned int * width_return,
492 unsigned int * height_return,
493 Pixmap * bitmap_return, int * x_hot_return,
498 EXTERN int TkReadBitmapFile (Display * display, Drawable d,
499 const char * filename,
500 unsigned int * width_return,
501 unsigned int * height_return,
502 Pixmap * bitmap_return, int * x_hot_return,
494503 int * y_hot_return);
495504 #endif
496505 #ifndef TkScrollWindow_TCL_DECLARED
497506 #define TkScrollWindow_TCL_DECLARED
498507 /* 79 */
499 EXTERN int TkScrollWindow (Tk_Window tkwin, GC gc, int x, int y,
500 int width, int height, int dx, int dy,
508 EXTERN int TkScrollWindow (Tk_Window tkwin, GC gc, int x, int y,
509 int width, int height, int dx, int dy,
501510 TkRegion damageRgn);
502511 #endif
503512 #ifndef TkSelDeadWindow_TCL_DECLARED
524533 #ifndef TkSetWindowMenuBar_TCL_DECLARED
525534 #define TkSetWindowMenuBar_TCL_DECLARED
526535 /* 85 */
527 EXTERN void TkSetWindowMenuBar (Tcl_Interp * interp,
528 Tk_Window tkwin, char * oldMenuName,
536 EXTERN void TkSetWindowMenuBar (Tcl_Interp * interp,
537 Tk_Window tkwin, char * oldMenuName,
529538 char * menuName);
530539 #endif
531540 #ifndef TkStringToKeysym_TCL_DECLARED
536545 #ifndef TkThickPolyLineToArea_TCL_DECLARED
537546 #define TkThickPolyLineToArea_TCL_DECLARED
538547 /* 87 */
539 EXTERN int TkThickPolyLineToArea (double * coordPtr,
540 int numPoints, double width, int capStyle,
548 EXTERN int TkThickPolyLineToArea (double * coordPtr,
549 int numPoints, double width, int capStyle,
541550 int joinStyle, double * rectPtr);
542551 #endif
543552 #ifndef TkWmAddToColormapWindows_TCL_DECLARED
568577 #ifndef TkWmProtocolEventProc_TCL_DECLARED
569578 #define TkWmProtocolEventProc_TCL_DECLARED
570579 /* 93 */
571 EXTERN void TkWmProtocolEventProc (TkWindow * winPtr,
580 EXTERN void TkWmProtocolEventProc (TkWindow * winPtr,
572581 XEvent * evenvPtr);
573582 #endif
574583 #ifndef TkWmRemoveFromColormapWindows_TCL_DECLARED
579588 #ifndef TkWmRestackToplevel_TCL_DECLARED
580589 #define TkWmRestackToplevel_TCL_DECLARED
581590 /* 95 */
582 EXTERN void TkWmRestackToplevel (TkWindow * winPtr,
591 EXTERN void TkWmRestackToplevel (TkWindow * winPtr,
583592 int aboveBelow, TkWindow * otherPtr);
584593 #endif
585594 #ifndef TkWmSetClass_TCL_DECLARED
615624 #ifndef TkDebugConfig_TCL_DECLARED
616625 #define TkDebugConfig_TCL_DECLARED
617626 /* 102 */
618 EXTERN Tcl_Obj * TkDebugConfig (Tcl_Interp * interp,
627 EXTERN Tcl_Obj * TkDebugConfig (Tcl_Interp * interp,
619628 Tk_OptionTable table);
620629 #endif
621630 #ifndef TkDebugFont_TCL_DECLARED
626635 #ifndef TkFindStateNumObj_TCL_DECLARED
627636 #define TkFindStateNumObj_TCL_DECLARED
628637 /* 104 */
629 EXTERN int TkFindStateNumObj (Tcl_Interp * interp,
630 Tcl_Obj * optionPtr,
631 CONST TkStateMap * mapPtr, Tcl_Obj * keyPtr);
638 EXTERN int TkFindStateNumObj (Tcl_Interp * interp,
639 Tcl_Obj * optionPtr,
640 const TkStateMap * mapPtr, Tcl_Obj * keyPtr);
632641 #endif
633642 #ifndef TkGetBitmapPredefTable_TCL_DECLARED
634643 #define TkGetBitmapPredefTable_TCL_DECLARED
648657 #ifndef TkGetWindowFromObj_TCL_DECLARED
649658 #define TkGetWindowFromObj_TCL_DECLARED
650659 /* 108 */
651 EXTERN int TkGetWindowFromObj (Tcl_Interp * interp,
652 Tk_Window tkwin, Tcl_Obj * objPtr,
660 EXTERN int TkGetWindowFromObj (Tcl_Interp * interp,
661 Tk_Window tkwin, Tcl_Obj * objPtr,
653662 Tk_Window * windowPtr);
654663 #endif
655664 #ifndef TkpGetString_TCL_DECLARED
656665 #define TkpGetString_TCL_DECLARED
657666 /* 109 */
658 EXTERN char * TkpGetString (TkWindow * winPtr, XEvent * eventPtr,
667 EXTERN char * TkpGetString (TkWindow * winPtr, XEvent * eventPtr,
659668 Tcl_DString * dsPtr);
660669 #endif
661670 #ifndef TkpGetSubFonts_TCL_DECLARED
666675 #ifndef TkpGetSystemDefault_TCL_DECLARED
667676 #define TkpGetSystemDefault_TCL_DECLARED
668677 /* 111 */
669 EXTERN Tcl_Obj * TkpGetSystemDefault (Tk_Window tkwin,
670 CONST char * dbName, CONST char * className);
678 EXTERN Tcl_Obj * TkpGetSystemDefault (Tk_Window tkwin,
679 const char * dbName, const char * className);
671680 #endif
672681 #ifndef TkpMenuThreadInit_TCL_DECLARED
673682 #define TkpMenuThreadInit_TCL_DECLARED
720729 #ifndef TkIntersectRegion_TCL_DECLARED
721730 #define TkIntersectRegion_TCL_DECLARED
722731 /* 116 */
723 EXTERN void TkIntersectRegion (TkRegion sra, TkRegion srcb,
732 EXTERN void TkIntersectRegion (TkRegion sra, TkRegion srcb,
724733 TkRegion dr_return);
725734 #endif
726735 #endif /* WIN */
728737 #ifndef TkIntersectRegion_TCL_DECLARED
729738 #define TkIntersectRegion_TCL_DECLARED
730739 /* 116 */
731 EXTERN void TkIntersectRegion (TkRegion sra, TkRegion srcb,
740 EXTERN void TkIntersectRegion (TkRegion sra, TkRegion srcb,
732741 TkRegion dr_return);
733742 #endif
734743 #endif /* AQUA */
736745 #ifndef TkRectInRegion_TCL_DECLARED
737746 #define TkRectInRegion_TCL_DECLARED
738747 /* 117 */
739 EXTERN int TkRectInRegion (TkRegion rgn, int x, int y,
748 EXTERN int TkRectInRegion (TkRegion rgn, int x, int y,
740749 unsigned int width, unsigned int height);
741750 #endif
742751 #endif /* WIN */
744753 #ifndef TkRectInRegion_TCL_DECLARED
745754 #define TkRectInRegion_TCL_DECLARED
746755 /* 117 */
747 EXTERN int TkRectInRegion (TkRegion rgn, int x, int y,
756 EXTERN int TkRectInRegion (TkRegion rgn, int x, int y,
748757 unsigned int width, unsigned int height);
749758 #endif
750759 #endif /* AQUA */
766775 #ifndef TkUnionRectWithRegion_TCL_DECLARED
767776 #define TkUnionRectWithRegion_TCL_DECLARED
768777 /* 119 */
769 EXTERN void TkUnionRectWithRegion (XRectangle * rect,
778 EXTERN void TkUnionRectWithRegion (XRectangle * rect,
770779 TkRegion src, TkRegion dr_return);
771780 #endif
772781 #endif /* WIN */
774783 #ifndef TkUnionRectWithRegion_TCL_DECLARED
775784 #define TkUnionRectWithRegion_TCL_DECLARED
776785 /* 119 */
777 EXTERN void TkUnionRectWithRegion (XRectangle * rect,
786 EXTERN void TkUnionRectWithRegion (XRectangle * rect,
778787 TkRegion src, TkRegion dr_return);
779788 #endif
780789 #endif /* AQUA */
783792 #ifndef TkpCreateNativeBitmap_TCL_DECLARED
784793 #define TkpCreateNativeBitmap_TCL_DECLARED
785794 /* 121 */
786 EXTERN Pixmap TkpCreateNativeBitmap (Display * display,
787 CONST char * source);
795 EXTERN Pixmap TkpCreateNativeBitmap (Display * display,
796 const char * source);
788797 #endif
789798 #endif /* AQUA */
790799 #ifdef MAC_OSX_TK /* AQUA */
799808 #ifndef TkpGetNativeAppBitmap_TCL_DECLARED
800809 #define TkpGetNativeAppBitmap_TCL_DECLARED
801810 /* 124 */
802 EXTERN Pixmap TkpGetNativeAppBitmap (Display * display,
803 CONST char * name, int * width, int * height);
811 EXTERN Pixmap TkpGetNativeAppBitmap (Display * display,
812 const char * name, int * width, int * height);
804813 #endif
805814 #endif /* AQUA */
806815 /* Slot 125 is reserved */
816825 #ifndef TkpDrawHighlightBorder_TCL_DECLARED
817826 #define TkpDrawHighlightBorder_TCL_DECLARED
818827 /* 135 */
819 EXTERN void TkpDrawHighlightBorder (Tk_Window tkwin, GC fgGC,
820 GC bgGC, int highlightWidth,
828 EXTERN void TkpDrawHighlightBorder (Tk_Window tkwin, GC fgGC,
829 GC bgGC, int highlightWidth,
821830 Drawable drawable);
822831 #endif
823832 #ifndef TkSetFocusWin_TCL_DECLARED
828837 #ifndef TkpSetKeycodeAndState_TCL_DECLARED
829838 #define TkpSetKeycodeAndState_TCL_DECLARED
830839 /* 137 */
831 EXTERN void TkpSetKeycodeAndState (Tk_Window tkwin,
840 EXTERN void TkpSetKeycodeAndState (Tk_Window tkwin,
832841 KeySym keySym, XEvent * eventPtr);
833842 #endif
834843 #ifndef TkpGetKeySym_TCL_DECLARED
870879 #ifndef TkSubtractRegion_TCL_DECLARED
871880 #define TkSubtractRegion_TCL_DECLARED
872881 /* 145 */
873 EXTERN void TkSubtractRegion (TkRegion sra, TkRegion srcb,
882 EXTERN void TkSubtractRegion (TkRegion sra, TkRegion srcb,
874883 TkRegion dr_return);
875884 #endif
876885 #endif /* WIN */
878887 #ifndef TkSubtractRegion_TCL_DECLARED
879888 #define TkSubtractRegion_TCL_DECLARED
880889 /* 145 */
881 EXTERN void TkSubtractRegion (TkRegion sra, TkRegion srcb,
890 EXTERN void TkSubtractRegion (TkRegion sra, TkRegion srcb,
882891 TkRegion dr_return);
883892 #endif
884893 #endif /* AQUA */
895904 #ifndef TkToplevelWindowForCommand_TCL_DECLARED
896905 #define TkToplevelWindowForCommand_TCL_DECLARED
897906 /* 148 */
898 EXTERN Tk_Window TkToplevelWindowForCommand (Tcl_Interp * interp,
899 CONST char * cmdName);
907 EXTERN Tk_Window TkToplevelWindowForCommand (Tcl_Interp * interp,
908 const char * cmdName);
900909 #endif
901910 #ifndef TkGetOptionSpec_TCL_DECLARED
902911 #define TkGetOptionSpec_TCL_DECLARED
903912 /* 149 */
904 EXTERN CONST Tk_OptionSpec * TkGetOptionSpec (CONST char * name,
913 EXTERN const Tk_OptionSpec * TkGetOptionSpec (const char * name,
905914 Tk_OptionTable optionTable);
906915 #endif
907916 #ifndef TkMakeRawCurve_TCL_DECLARED
908917 #define TkMakeRawCurve_TCL_DECLARED
909918 /* 150 */
910 EXTERN int TkMakeRawCurve (Tk_Canvas canvas, double * pointPtr,
911 int numPoints, int numSteps,
919 EXTERN int TkMakeRawCurve (Tk_Canvas canvas, double * pointPtr,
920 int numPoints, int numSteps,
912921 XPoint xPoints[], double dblPoints[]);
913922 #endif
914923 #ifndef TkMakeRawCurvePostscript_TCL_DECLARED
915924 #define TkMakeRawCurvePostscript_TCL_DECLARED
916925 /* 151 */
917 EXTERN void TkMakeRawCurvePostscript (Tcl_Interp * interp,
918 Tk_Canvas canvas, double * pointPtr,
926 EXTERN void TkMakeRawCurvePostscript (Tcl_Interp * interp,
927 Tk_Canvas canvas, double * pointPtr,
919928 int numPoints);
920929 #endif
921930 #ifndef TkpDrawFrame_TCL_DECLARED
922931 #define TkpDrawFrame_TCL_DECLARED
923932 /* 152 */
924 EXTERN void TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
925 int highlightWidth, int borderWidth,
933 EXTERN void TkpDrawFrame (Tk_Window tkwin, Tk_3DBorder border,
934 int highlightWidth, int borderWidth,
926935 int relief);
927936 #endif
928937 #ifndef TkCreateThreadExitHandler_TCL_DECLARED
929938 #define TkCreateThreadExitHandler_TCL_DECLARED
930939 /* 153 */
931 EXTERN void TkCreateThreadExitHandler (Tcl_ExitProc * proc,
940 EXTERN void TkCreateThreadExitHandler (Tcl_ExitProc * proc,
932941 ClientData clientData);
933942 #endif
934943 #ifndef TkDeleteThreadExitHandler_TCL_DECLARED
935944 #define TkDeleteThreadExitHandler_TCL_DECLARED
936945 /* 154 */
937 EXTERN void TkDeleteThreadExitHandler (Tcl_ExitProc * proc,
946 EXTERN void TkDeleteThreadExitHandler (Tcl_ExitProc * proc,
938947 ClientData clientData);
939948 #endif
940949 /* Slot 155 is reserved */
941950 #ifndef TkpTestembedCmd_TCL_DECLARED
942951 #define TkpTestembedCmd_TCL_DECLARED
943952 /* 156 */
944 EXTERN int TkpTestembedCmd (ClientData clientData,
945 Tcl_Interp * interp, int argc,
946 CONST char ** argv);
953 EXTERN int TkpTestembedCmd (ClientData clientData,
954 Tcl_Interp * interp, int argc,
955 const char ** argv);
947956 #endif
948957 #ifndef TkpTesttextCmd_TCL_DECLARED
949958 #define TkpTesttextCmd_TCL_DECLARED
950959 /* 157 */
951 EXTERN int TkpTesttextCmd (ClientData dummy,
952 Tcl_Interp * interp, int argc,
953 CONST char ** argv);
960 EXTERN int TkpTesttextCmd (ClientData dummy,
961 Tcl_Interp * interp, int argc,
962 const char ** argv);
963 #endif
964 #ifndef TkSelGetSelection_TCL_DECLARED
965 #define TkSelGetSelection_TCL_DECLARED
966 /* 158 */
967 EXTERN int TkSelGetSelection (Tcl_Interp * interp,
968 Tk_Window tkwin, Atom selection, Atom target,
969 Tk_GetSelProc * proc, ClientData clientData);
970 #endif
971 #ifndef TkTextGetIndex_TCL_DECLARED
972 #define TkTextGetIndex_TCL_DECLARED
973 /* 159 */
974 EXTERN int TkTextGetIndex (Tcl_Interp * interp,
975 struct TkText * textPtr, const char * string,
976 struct TkTextIndex * indexPtr);
977 #endif
978 #ifndef TkTextIndexBackBytes_TCL_DECLARED
979 #define TkTextIndexBackBytes_TCL_DECLARED
980 /* 160 */
981 EXTERN int TkTextIndexBackBytes (const struct TkText * textPtr,
982 const struct TkTextIndex * srcPtr, int count,
983 struct TkTextIndex * dstPtr);
984 #endif
985 #ifndef TkTextIndexForwBytes_TCL_DECLARED
986 #define TkTextIndexForwBytes_TCL_DECLARED
987 /* 161 */
988 EXTERN int TkTextIndexForwBytes (const struct TkText * textPtr,
989 const struct TkTextIndex * srcPtr, int count,
990 struct TkTextIndex * dstPtr);
991 #endif
992 #ifndef TkTextMakeByteIndex_TCL_DECLARED
993 #define TkTextMakeByteIndex_TCL_DECLARED
994 /* 162 */
995 EXTERN struct TkTextIndex * TkTextMakeByteIndex (TkTextBTree tree,
996 const struct TkText * textPtr, int lineIndex,
997 int byteIndex, struct TkTextIndex * indexPtr);
998 #endif
999 #ifndef TkTextPrintIndex_TCL_DECLARED
1000 #define TkTextPrintIndex_TCL_DECLARED
1001 /* 163 */
1002 EXTERN int TkTextPrintIndex (const struct TkText * textPtr,
1003 const struct TkTextIndex * indexPtr,
1004 char * string);
1005 #endif
1006 #ifndef TkTextSetMark_TCL_DECLARED
1007 #define TkTextSetMark_TCL_DECLARED
1008 /* 164 */
1009 EXTERN struct TkTextSegment * TkTextSetMark (struct TkText * textPtr,
1010 const char * name,
1011 struct TkTextIndex * indexPtr);
1012 #endif
1013 #ifndef TkTextXviewCmd_TCL_DECLARED
1014 #define TkTextXviewCmd_TCL_DECLARED
1015 /* 165 */
1016 EXTERN int TkTextXviewCmd (struct TkText * textPtr,
1017 Tcl_Interp * interp, int objc,
1018 Tcl_Obj *const objv[]);
1019 #endif
1020 #ifndef TkTextChanged_TCL_DECLARED
1021 #define TkTextChanged_TCL_DECLARED
1022 /* 166 */
1023 EXTERN void TkTextChanged (struct TkSharedText * sharedTextPtr,
1024 struct TkText * textPtr,
1025 const struct TkTextIndex * index1Ptr,
1026 const struct TkTextIndex * index2Ptr);
1027 #endif
1028 #ifndef TkBTreeNumLines_TCL_DECLARED
1029 #define TkBTreeNumLines_TCL_DECLARED
1030 /* 167 */
1031 EXTERN int TkBTreeNumLines (TkTextBTree tree,
1032 const struct TkText * textPtr);
1033 #endif
1034 #ifndef TkTextInsertDisplayProc_TCL_DECLARED
1035 #define TkTextInsertDisplayProc_TCL_DECLARED
1036 /* 168 */
1037 EXTERN void TkTextInsertDisplayProc (struct TkText * textPtr,
1038 struct TkTextDispChunk * chunkPtr, int x,
1039 int y, int height, int baseline,
1040 Display * display, Drawable dst, int screenY);
9541041 #endif
9551042
9561043 typedef struct TkIntStubs {
9571044 int magic;
958 CONST struct TkIntStubHooks *hooks;
1045 const struct TkIntStubHooks *hooks;
9591046
9601047 TkWindow * (*tkAllocWindow) (TkDisplay * dispPtr, int screenNum, TkWindow * parentPtr); /* 0 */
9611048 void (*tkBezierPoints) (double control[], int numSteps, double * coordPtr); /* 1 */
9681055 int (*tkClipInit) (Tcl_Interp * interp, TkDisplay * dispPtr); /* 8 */
9691056 void (*tkComputeAnchor) (Tk_Anchor anchor, Tk_Window tkwin, int padX, int padY, int innerWidth, int innerHeight, int * xPtr, int * yPtr); /* 9 */
9701057 int (*tkCopyAndGlobalEval) (Tcl_Interp * interp, char * script); /* 10 */
971 unsigned long (*tkCreateBindingProcedure) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, CONST char * eventString, TkBindEvalProc * evalProc, TkBindFreeProc * freeProc, ClientData clientData); /* 11 */
972 TkCursor * (*tkCreateCursorFromData) (Tk_Window tkwin, CONST char * source, CONST char * mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 12 */
973 int (*tkCreateFrame) (ClientData clientData, Tcl_Interp * interp, int argc, char ** argv, int toplevel, char * appName); /* 13 */
974 Tk_Window (*tkCreateMainWindow) (Tcl_Interp * interp, CONST char * screenName, char * baseName); /* 14 */
1058 unsigned long (*tkCreateBindingProcedure) (Tcl_Interp * interp, Tk_BindingTable bindingTable, ClientData object, const char * eventString, TkBindEvalProc * evalProc, TkBindFreeProc * freeProc, ClientData clientData); /* 11 */
1059 TkCursor * (*tkCreateCursorFromData) (Tk_Window tkwin, const char * source, const char * mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 12 */
1060 int (*tkCreateFrame) (ClientData clientData, Tcl_Interp * interp, int argc, const char *const * argv, int toplevel, const char * appName); /* 13 */
1061 Tk_Window (*tkCreateMainWindow) (Tcl_Interp * interp, const char * screenName, const char * baseName); /* 14 */
9751062 Time (*tkCurrentTime) (TkDisplay * dispPtr); /* 15 */
9761063 void (*tkDeleteAllImages) (TkMainInfo * mainPtr); /* 16 */
9771064 void (*tkDoConfigureNotify) (TkWindow * winPtr); /* 17 */
9781065 void (*tkDrawInsetFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable, int padding); /* 18 */
9791066 void (*tkEventDeadWindow) (TkWindow * winPtr); /* 19 */
9801067 void (*tkFillPolygon) (Tk_Canvas canvas, double * coordPtr, int numPoints, Display * display, Drawable drawable, GC gc, GC outlineGC); /* 20 */
981 int (*tkFindStateNum) (Tcl_Interp * interp, CONST char * option, CONST TkStateMap * mapPtr, CONST char * strKey); /* 21 */
982 char * (*tkFindStateString) (CONST TkStateMap * mapPtr, int numKey); /* 22 */
1068 int (*tkFindStateNum) (Tcl_Interp * interp, const char * option, const TkStateMap * mapPtr, const char * strKey); /* 21 */
1069 char * (*tkFindStateString) (const TkStateMap * mapPtr, int numKey); /* 22 */
9831070 void (*tkFocusDeadWindow) (TkWindow * winPtr); /* 23 */
9841071 int (*tkFocusFilterEvent) (TkWindow * winPtr, XEvent * eventPtr); /* 24 */
9851072 TkWindow * (*tkFocusKeyEvent) (TkWindow * winPtr, XEvent * eventPtr); /* 25 */
9871074 void (*tkFontPkgFree) (TkMainInfo * mainPtr); /* 27 */
9881075 void (*tkFreeBindingTags) (TkWindow * winPtr); /* 28 */
9891076 void (*tkpFreeCursor) (TkCursor * cursorPtr); /* 29 */
990 char * (*tkGetBitmapData) (Tcl_Interp * interp, char * string, char * fileName, int * widthPtr, int * heightPtr, int * hotXPtr, int * hotYPtr); /* 30 */
1077 char * (*tkGetBitmapData) (Tcl_Interp * interp, const char * string, const char * fileName, int * widthPtr, int * heightPtr, int * hotXPtr, int * hotYPtr); /* 30 */
9911078 void (*tkGetButtPoints) (double p1[], double p2[], double width, int project, double m1[], double m2[]); /* 31 */
9921079 TkCursor * (*tkGetCursorByName) (Tcl_Interp * interp, Tk_Window tkwin, Tk_Uid string); /* 32 */
993 CONST84_RETURN char * (*tkGetDefaultScreenName) (Tcl_Interp * interp, CONST char * screenName); /* 33 */
1080 const char * (*tkGetDefaultScreenName) (Tcl_Interp * interp, const char * screenName); /* 33 */
9941081 TkDisplay * (*tkGetDisplay) (Display * display); /* 34 */
995 int (*tkGetDisplayOf) (Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], Tk_Window * tkwinPtr); /* 35 */
1082 int (*tkGetDisplayOf) (Tcl_Interp * interp, int objc, Tcl_Obj *const objv[], Tk_Window * tkwinPtr); /* 35 */
9961083 TkWindow * (*tkGetFocusWin) (TkWindow * winPtr); /* 36 */
9971084 int (*tkGetInterpNames) (Tcl_Interp * interp, Tk_Window tkwin); /* 37 */
9981085 int (*tkGetMiterPoints) (double p1[], double p2[], double p3[], double width, double m1[], double m2[]); /* 38 */
10151102 int (*tkpChangeFocus) (TkWindow * winPtr, int force); /* 55 */
10161103 void (*tkpCloseDisplay) (TkDisplay * dispPtr); /* 56 */
10171104 void (*tkpClaimFocus) (TkWindow * topLevelPtr, int force); /* 57 */
1018 void (*tkpDisplayWarning) (CONST char * msg, CONST char * title); /* 58 */
1105 void (*tkpDisplayWarning) (const char * msg, const char * title); /* 58 */
10191106 void (*tkpGetAppName) (Tcl_Interp * interp, Tcl_DString * name); /* 59 */
10201107 TkWindow * (*tkpGetOtherWindow) (TkWindow * winPtr); /* 60 */
10211108 TkWindow * (*tkpGetWrapperWindow) (TkWindow * winPtr); /* 61 */
10251112 void (*tkpMakeMenuWindow) (Tk_Window tkwin, int transient); /* 65 */
10261113 Window (*tkpMakeWindow) (TkWindow * winPtr, Window parent); /* 66 */
10271114 void (*tkpMenuNotifyToplevelCreate) (Tcl_Interp * interp1, char * menuName); /* 67 */
1028 TkDisplay * (*tkpOpenDisplay) (CONST char * display_name); /* 68 */
1115 TkDisplay * (*tkpOpenDisplay) (const char * display_name); /* 68 */
10291116 int (*tkPointerEvent) (XEvent * eventPtr, TkWindow * winPtr); /* 69 */
10301117 int (*tkPolygonToArea) (double * polyPtr, int numPoints, double * rectPtr); /* 70 */
10311118 double (*tkPolygonToPoint) (double * polyPtr, int numPoints, double * pointPtr); /* 71 */
10321119 int (*tkPositionInTree) (TkWindow * winPtr, TkWindow * treePtr); /* 72 */
10331120 void (*tkpRedirectKeyEvent) (TkWindow * winPtr, XEvent * eventPtr); /* 73 */
10341121 void (*tkpSetMainMenubar) (Tcl_Interp * interp, Tk_Window tkwin, char * menuName); /* 74 */
1035 int (*tkpUseWindow) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * string); /* 75 */
1122 int (*tkpUseWindow) (Tcl_Interp * interp, Tk_Window tkwin, const char * string); /* 75 */
10361123 void *reserved76;
10371124 void (*tkQueueEventForAllChildren) (TkWindow * winPtr, XEvent * eventPtr); /* 77 */
1038 int (*tkReadBitmapFile) (Display * display, Drawable d, CONST char * filename, unsigned int * width_return, unsigned int * height_return, Pixmap * bitmap_return, int * x_hot_return, int * y_hot_return); /* 78 */
1125 int (*tkReadBitmapFile) (Display * display, Drawable d, const char * filename, unsigned int * width_return, unsigned int * height_return, Pixmap * bitmap_return, int * x_hot_return, int * y_hot_return); /* 78 */
10391126 int (*tkScrollWindow) (Tk_Window tkwin, GC gc, int x, int y, int width, int height, int dx, int dy, TkRegion damageRgn); /* 79 */
10401127 void (*tkSelDeadWindow) (TkWindow * winPtr); /* 80 */
10411128 void (*tkSelEventProc) (Tk_Window tkwin, XEvent * eventPtr); /* 81 */
10611148 Tcl_Obj * (*tkDebugColor) (Tk_Window tkwin, char * name); /* 101 */
10621149 Tcl_Obj * (*tkDebugConfig) (Tcl_Interp * interp, Tk_OptionTable table); /* 102 */
10631150 Tcl_Obj * (*tkDebugFont) (Tk_Window tkwin, char * name); /* 103 */
1064 int (*tkFindStateNumObj) (Tcl_Interp * interp, Tcl_Obj * optionPtr, CONST TkStateMap * mapPtr, Tcl_Obj * keyPtr); /* 104 */
1151 int (*tkFindStateNumObj) (Tcl_Interp * interp, Tcl_Obj * optionPtr, const TkStateMap * mapPtr, Tcl_Obj * keyPtr); /* 104 */
10651152 Tcl_HashTable * (*tkGetBitmapPredefTable) (void); /* 105 */
10661153 TkDisplay * (*tkGetDisplayList) (void); /* 106 */
10671154 TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */
10681155 int (*tkGetWindowFromObj) (Tcl_Interp * interp, Tk_Window tkwin, Tcl_Obj * objPtr, Tk_Window * windowPtr); /* 108 */
10691156 char * (*tkpGetString) (TkWindow * winPtr, XEvent * eventPtr, Tcl_DString * dsPtr); /* 109 */
10701157 void (*tkpGetSubFonts) (Tcl_Interp * interp, Tk_Font tkfont); /* 110 */
1071 Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, CONST char * dbName, CONST char * className); /* 111 */
1158 Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char * dbName, const char * className); /* 111 */
10721159 void (*tkpMenuThreadInit) (void); /* 112 */
10731160 #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
10741161 void *reserved113;
11491236 #endif /* WIN */
11501237 #ifdef MAC_OSX_TK /* AQUA */
11511238 void *reserved121; /* Dummy entry for stubs table backwards compatibility */
1152 Pixmap (*tkpCreateNativeBitmap) (Display * display, CONST char * source); /* 121 */
1239 Pixmap (*tkpCreateNativeBitmap) (Display * display, const char * source); /* 121 */
11531240 #endif /* AQUA */
11541241 #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
11551242 void *reserved122;
11701257 #endif /* WIN */
11711258 #ifdef MAC_OSX_TK /* AQUA */
11721259 void *reserved124; /* Dummy entry for stubs table backwards compatibility */
1173 Pixmap (*tkpGetNativeAppBitmap) (Display * display, CONST char * name, int * width, int * height); /* 124 */
1260 Pixmap (*tkpGetNativeAppBitmap) (Display * display, const char * name, int * width, int * height); /* 124 */
11741261 #endif /* AQUA */
11751262 void *reserved125;
11761263 void *reserved126;
12041291 #endif /* AQUA */
12051292 void (*tkStylePkgInit) (TkMainInfo * mainPtr); /* 146 */
12061293 void (*tkStylePkgFree) (TkMainInfo * mainPtr); /* 147 */
1207 Tk_Window (*tkToplevelWindowForCommand) (Tcl_Interp * interp, CONST char * cmdName); /* 148 */
1208 CONST Tk_OptionSpec * (*tkGetOptionSpec) (CONST char * name, Tk_OptionTable optionTable); /* 149 */
1294 Tk_Window (*tkToplevelWindowForCommand) (Tcl_Interp * interp, const char * cmdName); /* 148 */
1295 const Tk_OptionSpec * (*tkGetOptionSpec) (const char * name, Tk_OptionTable optionTable); /* 149 */
12091296 int (*tkMakeRawCurve) (Tk_Canvas canvas, double * pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 150 */
12101297 void (*tkMakeRawCurvePostscript) (Tcl_Interp * interp, Tk_Canvas canvas, double * pointPtr, int numPoints); /* 151 */
12111298 void (*tkpDrawFrame) (Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); /* 152 */
12121299 void (*tkCreateThreadExitHandler) (Tcl_ExitProc * proc, ClientData clientData); /* 153 */
12131300 void (*tkDeleteThreadExitHandler) (Tcl_ExitProc * proc, ClientData clientData); /* 154 */
12141301 void *reserved155;
1215 int (*tkpTestembedCmd) (ClientData clientData, Tcl_Interp * interp, int argc, CONST char ** argv); /* 156 */
1216 int (*tkpTesttextCmd) (ClientData dummy, Tcl_Interp * interp, int argc, CONST char ** argv); /* 157 */
1302 int (*tkpTestembedCmd) (ClientData clientData, Tcl_Interp * interp, int argc, const char ** argv); /* 156 */
1303 int (*tkpTesttextCmd) (ClientData dummy, Tcl_Interp * interp, int argc, const char ** argv); /* 157 */
1304 int (*tkSelGetSelection) (Tcl_Interp * interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc * proc, ClientData clientData); /* 158 */
1305 int (*tkTextGetIndex) (Tcl_Interp * interp, struct TkText * textPtr, const char * string, struct TkTextIndex * indexPtr); /* 159 */
1306 int (*tkTextIndexBackBytes) (const struct TkText * textPtr, const struct TkTextIndex * srcPtr, int count, struct TkTextIndex * dstPtr); /* 160 */
1307 int (*tkTextIndexForwBytes) (const struct TkText * textPtr, const struct TkTextIndex * srcPtr, int count, struct TkTextIndex * dstPtr); /* 161 */
1308 struct TkTextIndex * (*tkTextMakeByteIndex) (TkTextBTree tree, const struct TkText * textPtr, int lineIndex, int byteIndex, struct TkTextIndex * indexPtr); /* 162 */
1309 int (*tkTextPrintIndex) (const struct TkText * textPtr, const struct TkTextIndex * indexPtr, char * string); /* 163 */
1310 struct TkTextSegment * (*tkTextSetMark) (struct TkText * textPtr, const char * name, struct TkTextIndex * indexPtr); /* 164 */
1311 int (*tkTextXviewCmd) (struct TkText * textPtr, Tcl_Interp * interp, int objc, Tcl_Obj *const objv[]); /* 165 */
1312 void (*tkTextChanged) (struct TkSharedText * sharedTextPtr, struct TkText * textPtr, const struct TkTextIndex * index1Ptr, const struct TkTextIndex * index2Ptr); /* 166 */
1313 int (*tkBTreeNumLines) (TkTextBTree tree, const struct TkText * textPtr); /* 167 */
1314 void (*tkTextInsertDisplayProc) (struct TkText * textPtr, struct TkTextDispChunk * chunkPtr, int x, int y, int height, int baseline, Display * display, Drawable dst, int screenY); /* 168 */
12171315 } TkIntStubs;
12181316
12191317 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
1220 extern CONST TkIntStubs *tkIntStubsPtr;
1318 extern const TkIntStubs *tkIntStubsPtr;
12211319 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
12221320
12231321 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
18831981 #define TkpTesttextCmd \
18841982 (tkIntStubsPtr->tkpTesttextCmd) /* 157 */
18851983 #endif
1984 #ifndef TkSelGetSelection
1985 #define TkSelGetSelection \
1986 (tkIntStubsPtr->tkSelGetSelection) /* 158 */
1987 #endif
1988 #ifndef TkTextGetIndex
1989 #define TkTextGetIndex \
1990 (tkIntStubsPtr->tkTextGetIndex) /* 159 */
1991 #endif
1992 #ifndef TkTextIndexBackBytes
1993 #define TkTextIndexBackBytes \
1994 (tkIntStubsPtr->tkTextIndexBackBytes) /* 160 */
1995 #endif
1996 #ifndef TkTextIndexForwBytes
1997 #define TkTextIndexForwBytes \
1998 (tkIntStubsPtr->tkTextIndexForwBytes) /* 161 */
1999 #endif
2000 #ifndef TkTextMakeByteIndex
2001 #define TkTextMakeByteIndex \
2002 (tkIntStubsPtr->tkTextMakeByteIndex) /* 162 */
2003 #endif
2004 #ifndef TkTextPrintIndex
2005 #define TkTextPrintIndex \
2006 (tkIntStubsPtr->tkTextPrintIndex) /* 163 */
2007 #endif
2008 #ifndef TkTextSetMark
2009 #define TkTextSetMark \
2010 (tkIntStubsPtr->tkTextSetMark) /* 164 */
2011 #endif
2012 #ifndef TkTextXviewCmd
2013 #define TkTextXviewCmd \
2014 (tkIntStubsPtr->tkTextXviewCmd) /* 165 */
2015 #endif
2016 #ifndef TkTextChanged
2017 #define TkTextChanged \
2018 (tkIntStubsPtr->tkTextChanged) /* 166 */
2019 #endif
2020 #ifndef TkBTreeNumLines
2021 #define TkBTreeNumLines \
2022 (tkIntStubsPtr->tkBTreeNumLines) /* 167 */
2023 #endif
2024 #ifndef TkTextInsertDisplayProc
2025 #define TkTextInsertDisplayProc \
2026 (tkIntStubsPtr->tkTextInsertDisplayProc) /* 168 */
2027 #endif
18862028
18872029 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
18882030
88 * Copyright (c) 1998-1999 by Scriptics Corporation.
99 * All rights reserved.
1010 *
11 * RCS: @(#) $Id: tkIntPlatDecls.h,v 1.33 2008/08/19 15:52:12 georgeps Exp $
11 * RCS: @(#) $Id: tkIntPlatDecls.h,v 1.34 2008/10/22 20:56:43 nijtmans Exp $
1212 */
1313
1414 #ifndef _TKINTPLATDECLS
3535 #ifndef TkAlignImageData_TCL_DECLARED
3636 #define TkAlignImageData_TCL_DECLARED
3737 /* 0 */
38 EXTERN char * TkAlignImageData (XImage * image, int alignment,
38 EXTERN char * TkAlignImageData (XImage * image, int alignment,
3939 int bitOrder);
4040 #endif
4141 /* Slot 1 is reserved */
4242 #ifndef TkGenerateActivateEvents_TCL_DECLARED
4343 #define TkGenerateActivateEvents_TCL_DECLARED
4444 /* 2 */
45 EXTERN void TkGenerateActivateEvents (TkWindow * winPtr,
45 EXTERN void TkGenerateActivateEvents (TkWindow * winPtr,
4646 int active);
4747 #endif
4848 #ifndef TkpGetMS_TCL_DECLARED
6363 #ifndef TkpScanWindowId_TCL_DECLARED
6464 #define TkpScanWindowId_TCL_DECLARED
6565 /* 6 */
66 EXTERN int TkpScanWindowId (Tcl_Interp * interp,
67 CONST char * string, Window * idPtr);
66 EXTERN int TkpScanWindowId (Tcl_Interp * interp,
67 const char * string, Window * idPtr);
6868 #endif
6969 #ifndef TkpSetCapture_TCL_DECLARED
7070 #define TkpSetCapture_TCL_DECLARED
8484 #ifndef TkSetPixmapColormap_TCL_DECLARED
8585 #define TkSetPixmapColormap_TCL_DECLARED
8686 /* 10 */
87 EXTERN void TkSetPixmapColormap (Pixmap pixmap,
87 EXTERN void TkSetPixmapColormap (Pixmap pixmap,
8888 Colormap colormap);
8989 #endif
9090 #ifndef TkWinCancelMouseTimer_TCL_DECLARED
9595 #ifndef TkWinClipboardRender_TCL_DECLARED
9696 #define TkWinClipboardRender_TCL_DECLARED
9797 /* 12 */
98 EXTERN void TkWinClipboardRender (TkDisplay * dispPtr,
98 EXTERN void TkWinClipboardRender (TkDisplay * dispPtr,
9999 UINT format);
100100 #endif
101101 #ifndef TkWinEmbeddedEventProc_TCL_DECLARED
102102 #define TkWinEmbeddedEventProc_TCL_DECLARED
103103 /* 13 */
104 EXTERN LRESULT TkWinEmbeddedEventProc (HWND hwnd, UINT message,
104 EXTERN LRESULT TkWinEmbeddedEventProc (HWND hwnd, UINT message,
105105 WPARAM wParam, LPARAM lParam);
106106 #endif
107107 #ifndef TkWinFillRect_TCL_DECLARED
108108 #define TkWinFillRect_TCL_DECLARED
109109 /* 14 */
110 EXTERN void TkWinFillRect (HDC dc, int x, int y, int width,
110 EXTERN void TkWinFillRect (HDC dc, int x, int y, int width,
111111 int height, int pixel);
112112 #endif
113113 #ifndef TkWinGetBorderPixels_TCL_DECLARED
114114 #define TkWinGetBorderPixels_TCL_DECLARED
115115 /* 15 */
116 EXTERN COLORREF TkWinGetBorderPixels (Tk_Window tkwin,
116 EXTERN COLORREF TkWinGetBorderPixels (Tk_Window tkwin,
117117 Tk_3DBorder border, int which);
118118 #endif
119119 #ifndef TkWinGetDrawableDC_TCL_DECLARED
120120 #define TkWinGetDrawableDC_TCL_DECLARED
121121 /* 16 */
122 EXTERN HDC TkWinGetDrawableDC (Display * display, Drawable d,
122 EXTERN HDC TkWinGetDrawableDC (Display * display, Drawable d,
123123 TkWinDCState * state);
124124 #endif
125125 #ifndef TkWinGetModifierState_TCL_DECLARED
140140 #ifndef TkWinHandleMenuEvent_TCL_DECLARED
141141 #define TkWinHandleMenuEvent_TCL_DECLARED
142142 /* 20 */
143 EXTERN int TkWinHandleMenuEvent (HWND * phwnd, UINT * pMessage,
144 WPARAM * pwParam, LPARAM * plParam,
143 EXTERN int TkWinHandleMenuEvent (HWND * phwnd, UINT * pMessage,
144 WPARAM * pwParam, LPARAM * plParam,
145145 LRESULT * plResult);
146146 #endif
147147 #ifndef TkWinIndexOfColor_TCL_DECLARED
152152 #ifndef TkWinReleaseDrawableDC_TCL_DECLARED
153153 #define TkWinReleaseDrawableDC_TCL_DECLARED
154154 /* 22 */
155 EXTERN void TkWinReleaseDrawableDC (Drawable d, HDC hdc,
155 EXTERN void TkWinReleaseDrawableDC (Drawable d, HDC hdc,
156156 TkWinDCState * state);
157157 #endif
158158 #ifndef TkWinResendEvent_TCL_DECLARED
159159 #define TkWinResendEvent_TCL_DECLARED
160160 /* 23 */
161 EXTERN LRESULT TkWinResendEvent (WNDPROC wndproc, HWND hwnd,
161 EXTERN LRESULT TkWinResendEvent (WNDPROC wndproc, HWND hwnd,
162162 XEvent * eventPtr);
163163 #endif
164164 #ifndef TkWinSelectPalette_TCL_DECLARED
174174 #ifndef TkWinSetWindowPos_TCL_DECLARED
175175 #define TkWinSetWindowPos_TCL_DECLARED
176176 /* 26 */
177 EXTERN void TkWinSetWindowPos (HWND hwnd, HWND siblingHwnd,
177 EXTERN void TkWinSetWindowPos (HWND hwnd, HWND siblingHwnd,
178178 int pos);
179179 #endif
180180 #ifndef TkWinWmCleanup_TCL_DECLARED
205205 #ifndef TkWinGetMenuSystemDefault_TCL_DECLARED
206206 #define TkWinGetMenuSystemDefault_TCL_DECLARED
207207 /* 32 */
208 EXTERN Tcl_Obj * TkWinGetMenuSystemDefault (Tk_Window tkwin,
209 CONST char * dbName, CONST char * className);
208 EXTERN Tcl_Obj * TkWinGetMenuSystemDefault (Tk_Window tkwin,
209 const char * dbName, const char * className);
210210 #endif
211211 #ifndef TkWinGetPlatformId_TCL_DECLARED
212212 #define TkWinGetPlatformId_TCL_DECLARED
228228 #ifndef TkGenerateActivateEvents_TCL_DECLARED
229229 #define TkGenerateActivateEvents_TCL_DECLARED
230230 /* 0 */
231 EXTERN void TkGenerateActivateEvents (TkWindow * winPtr,
231 EXTERN void TkGenerateActivateEvents (TkWindow * winPtr,
232232 int active);
233233 #endif
234234 /* Slot 1 is reserved */
298298 #ifndef TkMacOSXGrowToplevel_TCL_DECLARED
299299 #define TkMacOSXGrowToplevel_TCL_DECLARED
300300 /* 17 */
301 EXTERN int TkMacOSXGrowToplevel (WindowRef whichWindow,
301 EXTERN int TkMacOSXGrowToplevel (WindowRef whichWindow,
302302 Point start);
303303 #endif
304304 #ifndef TkMacOSXHandleMenuSelect_TCL_DECLARED
305305 #define TkMacOSXHandleMenuSelect_TCL_DECLARED
306306 /* 18 */
307 EXTERN void TkMacOSXHandleMenuSelect (MenuID theMenu,
307 EXTERN void TkMacOSXHandleMenuSelect (MenuID theMenu,
308308 MenuItemIndex theItem, int optionKeyPressed);
309309 #endif
310310 /* Slot 19 is reserved */
312312 #ifndef TkMacOSXInvalidateWindow_TCL_DECLARED
313313 #define TkMacOSXInvalidateWindow_TCL_DECLARED
314314 /* 21 */
315 EXTERN void TkMacOSXInvalidateWindow (MacDrawable * macWin,
315 EXTERN void TkMacOSXInvalidateWindow (MacDrawable * macWin,
316316 int flag);
317317 #endif
318318 #ifndef TkMacOSXIsCharacterMissing_TCL_DECLARED
319319 #define TkMacOSXIsCharacterMissing_TCL_DECLARED
320320 /* 22 */
321 EXTERN int TkMacOSXIsCharacterMissing (Tk_Font tkfont,
321 EXTERN int TkMacOSXIsCharacterMissing (Tk_Font tkfont,
322322 unsigned int searchChar);
323323 #endif
324324 #ifndef TkMacOSXMakeRealWindowExist_TCL_DECLARED
339339 #ifndef TkMacOSXRegisterOffScreenWindow_TCL_DECLARED
340340 #define TkMacOSXRegisterOffScreenWindow_TCL_DECLARED
341341 /* 26 */
342 EXTERN void TkMacOSXRegisterOffScreenWindow (Window window,
342 EXTERN void TkMacOSXRegisterOffScreenWindow (Window window,
343343 GWorldPtr portPtr);
344344 #endif
345345 #ifndef TkMacOSXResizable_TCL_DECLARED
355355 #ifndef TkMacOSXSetScrollbarGrow_TCL_DECLARED
356356 #define TkMacOSXSetScrollbarGrow_TCL_DECLARED
357357 /* 29 */
358 EXTERN void TkMacOSXSetScrollbarGrow (TkWindow * winPtr,
358 EXTERN void TkMacOSXSetScrollbarGrow (TkWindow * winPtr,
359359 int flag);
360360 #endif
361361 #ifndef TkMacOSXSetUpClippingRgn_TCL_DECLARED
391391 #ifndef TkMacOSXWinBounds_TCL_DECLARED
392392 #define TkMacOSXWinBounds_TCL_DECLARED
393393 /* 36 */
394 EXTERN void TkMacOSXWinBounds (TkWindow * winPtr,
394 EXTERN void TkMacOSXWinBounds (TkWindow * winPtr,
395395 Rect * geometry);
396396 #endif
397397 #ifndef TkMacOSXWindowOffset_TCL_DECLARED
398398 #define TkMacOSXWindowOffset_TCL_DECLARED
399399 /* 37 */
400 EXTERN void TkMacOSXWindowOffset (WindowRef wRef, int * xOffset,
400 EXTERN void TkMacOSXWindowOffset (WindowRef wRef, int * xOffset,
401401 int * yOffset);
402402 #endif
403403 #ifndef TkSetMacColor_TCL_DECLARED
404404 #define TkSetMacColor_TCL_DECLARED
405405 /* 38 */
406 EXTERN int TkSetMacColor (unsigned long pixel,
406 EXTERN int TkSetMacColor (unsigned long pixel,
407407 RGBColor * macColor);
408408 #endif
409409 #ifndef TkSetWMName_TCL_DECLARED
419419 #ifndef TkMacOSXZoomToplevel_TCL_DECLARED
420420 #define TkMacOSXZoomToplevel_TCL_DECLARED
421421 /* 41 */
422 EXTERN int TkMacOSXZoomToplevel (WindowPtr whichWindow,
422 EXTERN int TkMacOSXZoomToplevel (WindowPtr whichWindow,
423423 short zoomPart);
424424 #endif
425425 #ifndef Tk_TopCoordsToWindow_TCL_DECLARED
426426 #define Tk_TopCoordsToWindow_TCL_DECLARED
427427 /* 42 */
428 EXTERN Tk_Window Tk_TopCoordsToWindow (Tk_Window tkwin, int rootX,
428 EXTERN Tk_Window Tk_TopCoordsToWindow (Tk_Window tkwin, int rootX,
429429 int rootY, int * newX, int * newY);
430430 #endif
431431 #ifndef TkMacOSXContainerId_TCL_DECLARED
462462 #ifndef TkGenerateButtonEvent_TCL_DECLARED
463463 #define TkGenerateButtonEvent_TCL_DECLARED
464464 /* 50 */
465 EXTERN int TkGenerateButtonEvent (int x, int y, Window window,
465 EXTERN int TkGenerateButtonEvent (int x, int y, Window window,
466466 unsigned int state);
467467 #endif
468468 #ifndef TkGenWMDestroyEvent_TCL_DECLARED
513513 #ifndef TkpScanWindowId_TCL_DECLARED
514514 #define TkpScanWindowId_TCL_DECLARED
515515 /* 8 */
516 EXTERN int TkpScanWindowId (Tcl_Interp * interp,
517 CONST char * string, Window * idPtr);
516 EXTERN int TkpScanWindowId (Tcl_Interp * interp,
517 const char * string, Window * idPtr);
518518 #endif
519519 #ifndef TkWmCleanup_TCL_DECLARED
520520 #define TkWmCleanup_TCL_DECLARED
535535 #ifndef TkpTestsendCmd_TCL_DECLARED
536536 #define TkpTestsendCmd_TCL_DECLARED
537537 /* 13 */
538 EXTERN int TkpTestsendCmd (ClientData clientData,
539 Tcl_Interp * interp, int argc,
540 CONST char ** argv);
538 EXTERN int TkpTestsendCmd (ClientData clientData,
539 Tcl_Interp * interp, int argc,
540 const char ** argv);
541541 #endif
542542 #endif /* X11 */
543543
544544 typedef struct TkIntPlatStubs {
545545 int magic;
546 CONST struct TkIntPlatStubHooks *hooks;
546 const struct TkIntPlatStubHooks *hooks;
547547
548548 #ifdef __WIN32__ /* WIN */
549549 char * (*tkAlignImageData) (XImage * image, int alignment, int bitOrder); /* 0 */
552552 unsigned long (*tkpGetMS) (void); /* 3 */
553553 void (*tkPointerDeadWindow) (TkWindow * winPtr); /* 4 */
554554 void (*tkpPrintWindowId) (char * buf, Window window); /* 5 */
555 int (*tkpScanWindowId) (Tcl_Interp * interp, CONST char * string, Window * idPtr); /* 6 */
555 int (*tkpScanWindowId) (Tcl_Interp * interp, const char * string, Window * idPtr); /* 6 */
556556 void (*tkpSetCapture) (TkWindow * winPtr); /* 7 */
557557 void (*tkpSetCursor) (TkpCursor cursor); /* 8 */
558558 void (*tkpWmSetState) (TkWindow * winPtr, int state); /* 9 */
578578 void (*tkWinXInit) (HINSTANCE hInstance); /* 29 */
579579 void (*tkWinSetForegroundWindow) (TkWindow * winPtr); /* 30 */
580580 void (*tkWinDialogDebug) (int debug); /* 31 */
581 Tcl_Obj * (*tkWinGetMenuSystemDefault) (Tk_Window tkwin, CONST char * dbName, CONST char * className); /* 32 */
581 Tcl_Obj * (*tkWinGetMenuSystemDefault) (Tk_Window tkwin, const char * dbName, const char * className); /* 32 */
582582 int (*tkWinGetPlatformId) (void); /* 33 */
583583 void (*tkWinSetHINSTANCE) (HINSTANCE hInstance); /* 34 */
584584 int (*tkWinGetPlatformTheme) (void); /* 35 */
648648 Window (*tkUnixContainerId) (TkWindow * winPtr); /* 5 */
649649 int (*tkUnixDoOneXEvent) (Tcl_Time * timePtr); /* 6 */
650650 void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 7 */
651 int (*tkpScanWindowId) (Tcl_Interp * interp, CONST char * string, Window * idPtr); /* 8 */
651 int (*tkpScanWindowId) (Tcl_Interp * interp, const char * string, Window * idPtr); /* 8 */
652652 void (*tkWmCleanup) (TkDisplay * dispPtr); /* 9 */
653653 void (*tkSendCleanup) (TkDisplay * dispPtr); /* 10 */
654654 void *reserved11;
655655 int (*tkpWmSetState) (TkWindow * winPtr, int state); /* 12 */
656 int (*tkpTestsendCmd) (ClientData clientData, Tcl_Interp * interp, int argc, CONST char ** argv); /* 13 */
656 int (*tkpTestsendCmd) (ClientData clientData, Tcl_Interp * interp, int argc, const char ** argv); /* 13 */
657657 #endif /* X11 */
658658 } TkIntPlatStubs;
659659
660660 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
661 extern CONST TkIntPlatStubs *tkIntPlatStubsPtr;
661 extern const TkIntPlatStubs *tkIntPlatStubsPtr;
662662 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
663663
664664 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
88 * Copyright (c) 1998-1999 by Scriptics Corporation.
99 * All rights reserved.
1010 *
11 * RCS: @(#) $Id: tkIntXlibDecls.h,v 1.26 2008/04/08 15:00:47 das Exp $
11 * RCS: @(#) $Id: tkIntXlibDecls.h,v 1.27 2008/10/22 20:56:43 nijtmans Exp $
1212 */
1313
1414 #ifndef _TKINTXLIBDECLS
3737 #ifndef XSetDashes_TCL_DECLARED
3838 #define XSetDashes_TCL_DECLARED
3939 /* 0 */
40 EXTERN void XSetDashes (Display * display, GC gc,
41 int dash_offset, _Xconst char * dash_list,
40 EXTERN void XSetDashes (Display * display, GC gc,
41 int dash_offset, _Xconst char * dash_list,
4242 int n);
4343 #endif
4444 #ifndef XGetModifierMapping_TCL_DECLARED
4949 #ifndef XCreateImage_TCL_DECLARED
5050 #define XCreateImage_TCL_DECLARED
5151 /* 2 */
52 EXTERN XImage * XCreateImage (Display * d, Visual * v,
53 unsigned int ui1, int i1, int i2, char * cp,
54 unsigned int ui2, unsigned int ui3, int i3,
52 EXTERN XImage * XCreateImage (Display * d, Visual * v,
53 unsigned int ui1, int i1, int i2, char * cp,
54 unsigned int ui2, unsigned int ui3, int i3,
5555 int i4);
5656 #endif
5757 #ifndef XGetImage_TCL_DECLARED
5858 #define XGetImage_TCL_DECLARED
5959 /* 3 */
60 EXTERN XImage * XGetImage (Display * d, Drawable dr, int i1, int i2,
61 unsigned int ui1, unsigned int ui2,
60 EXTERN XImage * XGetImage (Display * d, Drawable dr, int i1, int i2,
61 unsigned int ui1, unsigned int ui2,
6262 unsigned long ul, int i3);
6363 #endif
6464 #ifndef XGetAtomName_TCL_DECLARED
7474 #ifndef XCreateColormap_TCL_DECLARED
7575 #define XCreateColormap_TCL_DECLARED
7676 /* 6 */
77 EXTERN Colormap XCreateColormap (Display * d, Window w, Visual * v,
77 EXTERN Colormap XCreateColormap (Display * d, Window w, Visual * v,
7878 int i);
7979 #endif
8080 #ifndef XCreatePixmapCursor_TCL_DECLARED
8181 #define XCreatePixmapCursor_TCL_DECLARED
8282 /* 7 */
83 EXTERN Cursor XCreatePixmapCursor (Display * d, Pixmap p1,
84 Pixmap p2, XColor * x1, XColor * x2,
83 EXTERN Cursor XCreatePixmapCursor (Display * d, Pixmap p1,
84 Pixmap p2, XColor * x1, XColor * x2,
8585 unsigned int ui1, unsigned int ui2);
8686 #endif
8787 #ifndef XCreateGlyphCursor_TCL_DECLARED
8888 #define XCreateGlyphCursor_TCL_DECLARED
8989 /* 8 */
90 EXTERN Cursor XCreateGlyphCursor (Display * d, Font f1, Font f2,
91 unsigned int ui1, unsigned int ui2,
90 EXTERN Cursor XCreateGlyphCursor (Display * d, Font f1, Font f2,
91 unsigned int ui1, unsigned int ui2,
9292 XColor * x1, XColor * x2);
9393 #endif
9494 #ifndef XGContextFromGC_TCL_DECLARED
134134 #ifndef XGetWMColormapWindows_TCL_DECLARED
135135 #define XGetWMColormapWindows_TCL_DECLARED
136136 /* 17 */
137 EXTERN Status XGetWMColormapWindows (Display * d, Window w,
137 EXTERN Status XGetWMColormapWindows (Display * d, Window w,
138138 Window ** wpp, int * ip);
139139 #endif
140140 #ifndef XAllocColor_TCL_DECLARED
150150 #ifndef XChangeProperty_TCL_DECLARED
151151 #define XChangeProperty_TCL_DECLARED
152152 /* 20 */
153 EXTERN void XChangeProperty (Display * d, Window w, Atom a1,
154 Atom a2, int i1, int i2,
153 EXTERN void XChangeProperty (Display * d, Window w, Atom a1,
154 Atom a2, int i1, int i2,
155155 _Xconst unsigned char * c, int i3);
156156 #endif
157157 #ifndef XChangeWindowAttributes_TCL_DECLARED
158158 #define XChangeWindowAttributes_TCL_DECLARED
159159 /* 21 */
160 EXTERN void XChangeWindowAttributes (Display * d, Window w,
160 EXTERN void XChangeWindowAttributes (Display * d, Window w,
161161 unsigned long ul, XSetWindowAttributes * x);
162162 #endif
163163 #ifndef XClearWindow_TCL_DECLARED
168168 #ifndef XConfigureWindow_TCL_DECLARED
169169 #define XConfigureWindow_TCL_DECLARED
170170 /* 23 */
171 EXTERN void XConfigureWindow (Display * d, Window w,
171 EXTERN void XConfigureWindow (Display * d, Window w,
172172 unsigned int i, XWindowChanges * x);
173173 #endif
174174 #ifndef XCopyArea_TCL_DECLARED
175175 #define XCopyArea_TCL_DECLARED
176176 /* 24 */
177 EXTERN void XCopyArea (Display * d, Drawable dr1, Drawable dr2,
178 GC g, int i1, int i2, unsigned int ui1,
177 EXTERN void XCopyArea (Display * d, Drawable dr1, Drawable dr2,
178 GC g, int i1, int i2, unsigned int ui1,
179179 unsigned int ui2, int i3, int i4);
180180 #endif
181181 #ifndef XCopyPlane_TCL_DECLARED
182182 #define XCopyPlane_TCL_DECLARED
183183 /* 25 */
184 EXTERN void XCopyPlane (Display * d, Drawable dr1, Drawable dr2,
185 GC g, int i1, int i2, unsigned int ui1,
186 unsigned int ui2, int i3, int i4,
184 EXTERN void XCopyPlane (Display * d, Drawable dr1, Drawable dr2,
185 GC g, int i1, int i2, unsigned int ui1,
186 unsigned int ui2, int i3, int i4,
187187 unsigned long ul);
188188 #endif
189189 #ifndef XCreateBitmapFromData_TCL_DECLARED
190190 #define XCreateBitmapFromData_TCL_DECLARED
191191 /* 26 */
192 EXTERN Pixmap XCreateBitmapFromData (Display * display, Drawable d,
193 _Xconst char * data, unsigned int width,
192 EXTERN Pixmap XCreateBitmapFromData (Display * display, Drawable d,
193 _Xconst char * data, unsigned int width,
194194 unsigned int height);
195195 #endif
196196 #ifndef XDefineCursor_TCL_DECLARED
211211 #ifndef XDrawArc_TCL_DECLARED
212212 #define XDrawArc_TCL_DECLARED
213213 /* 30 */
214 EXTERN void XDrawArc (Display * d, Drawable dr, GC g, int i1,
215 int i2, unsigned int ui1, unsigned int ui2,
214 EXTERN void XDrawArc (Display * d, Drawable dr, GC g, int i1,
215 int i2, unsigned int ui1, unsigned int ui2,
216216 int i3, int i4);
217217 #endif
218218 #ifndef XDrawLines_TCL_DECLARED
219219 #define XDrawLines_TCL_DECLARED
220220 /* 31 */
221 EXTERN void XDrawLines (Display * d, Drawable dr, GC g,
221 EXTERN void XDrawLines (Display * d, Drawable dr, GC g,
222222 XPoint * x, int i1, int i2);
223223 #endif
224224 #ifndef XDrawRectangle_TCL_DECLARED
225225 #define XDrawRectangle_TCL_DECLARED
226226 /* 32 */
227 EXTERN void XDrawRectangle (Display * d, Drawable dr, GC g,
228 int i1, int i2, unsigned int ui1,
227 EXTERN void XDrawRectangle (Display * d, Drawable dr, GC g,
228 int i1, int i2, unsigned int ui1,
229229 unsigned int ui2);
230230 #endif
231231 #ifndef XFillArc_TCL_DECLARED
232232 #define XFillArc_TCL_DECLARED
233233 /* 33 */
234 EXTERN void XFillArc (Display * d, Drawable dr, GC g, int i1,
235 int i2, unsigned int ui1, unsigned int ui2,
234 EXTERN void XFillArc (Display * d, Drawable dr, GC g, int i1,
235 int i2, unsigned int ui1, unsigned int ui2,
236236 int i3, int i4);
237237 #endif
238238 #ifndef XFillPolygon_TCL_DECLARED
239239 #define XFillPolygon_TCL_DECLARED
240240 /* 34 */
241 EXTERN void XFillPolygon (Display * d, Drawable dr, GC g,
241 EXTERN void XFillPolygon (Display * d, Drawable dr, GC g,
242242 XPoint * x, int i1, int i2, int i3);
243243 #endif
244244 #ifndef XFillRectangles_TCL_DECLARED
245245 #define XFillRectangles_TCL_DECLARED
246246 /* 35 */
247 EXTERN void XFillRectangles (Display * d, Drawable dr, GC g,
247 EXTERN void XFillRectangles (Display * d, Drawable dr, GC g,
248248 XRectangle * x, int i);
249249 #endif
250250 #ifndef XForceScreenSaver_TCL_DECLARED
260260 #ifndef XFreeColors_TCL_DECLARED
261261 #define XFreeColors_TCL_DECLARED
262262 /* 38 */
263 EXTERN void XFreeColors (Display * d, Colormap c,
263 EXTERN void XFreeColors (Display * d, Colormap c,
264264 unsigned long * ulp, int i, unsigned long ul);
265265 #endif
266266 #ifndef XFreeCursor_TCL_DECLARED
276276 #ifndef XGetGeometry_TCL_DECLARED
277277 #define XGetGeometry_TCL_DECLARED
278278 /* 41 */
279 EXTERN Status XGetGeometry (Display * d, Drawable dr, Window * w,
280 int * i1, int * i2, unsigned int * ui1,
281 unsigned int * ui2, unsigned int * ui3,
279 EXTERN Status XGetGeometry (Display * d, Drawable dr, Window * w,
280 int * i1, int * i2, unsigned int * ui1,
281 unsigned int * ui2, unsigned int * ui3,
282282 unsigned int * ui4);
283283 #endif
284284 #ifndef XGetInputFocus_TCL_DECLARED
289289 #ifndef XGetWindowProperty_TCL_DECLARED
290290 #define XGetWindowProperty_TCL_DECLARED
291291 /* 43 */
292 EXTERN int XGetWindowProperty (Display * d, Window w, Atom a1,
293 long l1, long l2, Bool b, Atom a2, Atom * ap,
294 int * ip, unsigned long * ulp1,
292 EXTERN int XGetWindowProperty (Display * d, Window w, Atom a1,
293 long l1, long l2, Bool b, Atom a2, Atom * ap,
294 int * ip, unsigned long * ulp1,
295295 unsigned long * ulp2, unsigned char ** cpp);
296296 #endif
297297 #ifndef XGetWindowAttributes_TCL_DECLARED
298298 #define XGetWindowAttributes_TCL_DECLARED
299299 /* 44 */
300 EXTERN Status XGetWindowAttributes (Display * d, Window w,
300 EXTERN Status XGetWindowAttributes (Display * d, Window w,
301301 XWindowAttributes * x);
302302 #endif
303303 #ifndef XGrabKeyboard_TCL_DECLARED
304304 #define XGrabKeyboard_TCL_DECLARED
305305 /* 45 */
306 EXTERN int XGrabKeyboard (Display * d, Window w, Bool b, int i1,
306 EXTERN int XGrabKeyboard (Display * d, Window w, Bool b, int i1,
307307 int i2, Time t);
308308 #endif
309309 #ifndef XGrabPointer_TCL_DECLARED
310310 #define XGrabPointer_TCL_DECLARED
311311 /* 46 */
312 EXTERN int XGrabPointer (Display * d, Window w1, Bool b,
313 unsigned int ui, int i1, int i2, Window w2,
312 EXTERN int XGrabPointer (Display * d, Window w1, Bool b,
313 unsigned int ui, int i1, int i2, Window w2,
314314 Cursor c, Time t);
315315 #endif
316316 #ifndef XKeysymToKeycode_TCL_DECLARED
321321 #ifndef XLookupColor_TCL_DECLARED
322322 #define XLookupColor_TCL_DECLARED
323323 /* 48 */
324 EXTERN Status XLookupColor (Display * d, Colormap c1,
324 EXTERN Status XLookupColor (Display * d, Colormap c1,
325325 _Xconst char * c2, XColor * x1, XColor * x2);
326326 #endif
327327 #ifndef XMapWindow_TCL_DECLARED
332332 #ifndef XMoveResizeWindow_TCL_DECLARED
333333 #define XMoveResizeWindow_TCL_DECLARED
334334 /* 50 */
335 EXTERN void XMoveResizeWindow (Display * d, Window w, int i1,
335 EXTERN void XMoveResizeWindow (Display * d, Window w, int i1,
336336 int i2, unsigned int ui1, unsigned int ui2);
337337 #endif
338338 #ifndef XMoveWindow_TCL_DECLARED
353353 #ifndef XQueryColors_TCL_DECLARED
354354 #define XQueryColors_TCL_DECLARED
355355 /* 54 */
356 EXTERN void XQueryColors (Display * d, Colormap c, XColor * x,
356 EXTERN void XQueryColors (Display * d, Colormap c, XColor * x,
357357 int i);
358358 #endif
359359 #ifndef XQueryPointer_TCL_DECLARED
360360 #define XQueryPointer_TCL_DECLARED
361361 /* 55 */
362 EXTERN Bool XQueryPointer (Display * d, Window w1, Window * w2,
363 Window * w3, int * i1, int * i2, int * i3,
362 EXTERN Bool XQueryPointer (Display * d, Window w1, Window * w2,
363 Window * w3, int * i1, int * i2, int * i3,
364364 int * i4, unsigned int * ui);
365365 #endif
366366 #ifndef XQueryTree_TCL_DECLARED
367367 #define XQueryTree_TCL_DECLARED
368368 /* 56 */
369 EXTERN Status XQueryTree (Display * d, Window w1, Window * w2,
369 EXTERN Status XQueryTree (Display * d, Window w1, Window * w2,
370370 Window * w3, Window ** w4, unsigned int * ui);
371371 #endif
372372 #ifndef XRaiseWindow_TCL_DECLARED
382382 #ifndef XResizeWindow_TCL_DECLARED
383383 #define XResizeWindow_TCL_DECLARED
384384 /* 59 */
385 EXTERN void XResizeWindow (Display * d, Window w,
385 EXTERN void XResizeWindow (Display * d, Window w,
386386 unsigned int ui1, unsigned int ui2);
387387 #endif
388388 #ifndef XSelectInput_TCL_DECLARED
393393 #ifndef XSendEvent_TCL_DECLARED
394394 #define XSendEvent_TCL_DECLARED
395395 /* 61 */
396 EXTERN Status XSendEvent (Display * d, Window w, Bool b, long l,
396 EXTERN Status XSendEvent (Display * d, Window w, Bool b, long l,
397397 XEvent * x);
398398 #endif
399399 #ifndef XSetCommand_TCL_DECLARED
400400 #define XSetCommand_TCL_DECLARED
401401 /* 62 */
402 EXTERN void XSetCommand (Display * d, Window w, CONST char ** c,
402 EXTERN void XSetCommand (Display * d, Window w, const char ** c,
403403 int i);
404404 #endif
405405 #ifndef XSetIconName_TCL_DECLARED
406406 #define XSetIconName_TCL_DECLARED
407407 /* 63 */
408 EXTERN void XSetIconName (Display * d, Window w,
408 EXTERN void XSetIconName (Display * d, Window w,
409409 _Xconst char * c);
410410 #endif
411411 #ifndef XSetInputFocus_TCL_DECLARED
416416 #ifndef XSetSelectionOwner_TCL_DECLARED
417417 #define XSetSelectionOwner_TCL_DECLARED
418418 /* 65 */
419 EXTERN void XSetSelectionOwner (Display * d, Atom a, Window w,
419 EXTERN void XSetSelectionOwner (Display * d, Atom a, Window w,
420420 Time t);
421421 #endif
422422 #ifndef XSetWindowBackground_TCL_DECLARED
423423 #define XSetWindowBackground_TCL_DECLARED
424424 /* 66 */
425 EXTERN void XSetWindowBackground (Display * d, Window w,
425 EXTERN void XSetWindowBackground (Display * d, Window w,
426426 unsigned long ul);
427427 #endif
428428 #ifndef XSetWindowBackgroundPixmap_TCL_DECLARED
429429 #define XSetWindowBackgroundPixmap_TCL_DECLARED
430430 /* 67 */
431 EXTERN void XSetWindowBackgroundPixmap (Display * d, Window w,
431 EXTERN void XSetWindowBackgroundPixmap (Display * d, Window w,
432432 Pixmap p);
433433 #endif
434434 #ifndef XSetWindowBorder_TCL_DECLARED
435435 #define XSetWindowBorder_TCL_DECLARED
436436 /* 68 */
437 EXTERN void XSetWindowBorder (Display * d, Window w,
437 EXTERN void XSetWindowBorder (Display * d, Window w,
438438 unsigned long ul);
439439 #endif
440440 #ifndef XSetWindowBorderPixmap_TCL_DECLARED
441441 #define XSetWindowBorderPixmap_TCL_DECLARED
442442 /* 69 */
443 EXTERN void XSetWindowBorderPixmap (Display * d, Window w,
443 EXTERN void XSetWindowBorderPixmap (Display * d, Window w,
444444 Pixmap p);
445445 #endif
446446 #ifndef XSetWindowBorderWidth_TCL_DECLARED
447447 #define XSetWindowBorderWidth_TCL_DECLARED
448448 /* 70 */
449 EXTERN void XSetWindowBorderWidth (Display * d, Window w,
449 EXTERN void XSetWindowBorderWidth (Display * d, Window w,
450450 unsigned int ui);
451451 #endif
452452 #ifndef XSetWindowColormap_TCL_DECLARED
453453 #define XSetWindowColormap_TCL_DECLARED
454454 /* 71 */
455 EXTERN void XSetWindowColormap (Display * d, Window w,
455 EXTERN void XSetWindowColormap (Display * d, Window w,
456456 Colormap c);
457457 #endif
458458 #ifndef XTranslateCoordinates_TCL_DECLARED
459459 #define XTranslateCoordinates_TCL_DECLARED
460460 /* 72 */
461 EXTERN Bool XTranslateCoordinates (Display * d, Window w1,
462 Window w2, int i1, int i2, int * i3,
461 EXTERN Bool XTranslateCoordinates (Display * d, Window w1,
462 Window w2, int i1, int i2, int * i3,
463463 int * i4, Window * w3);
464464 #endif
465465 #ifndef XUngrabKeyboard_TCL_DECLARED
480480 #ifndef XWindowEvent_TCL_DECLARED
481481 #define XWindowEvent_TCL_DECLARED
482482 /* 76 */
483 EXTERN void XWindowEvent (Display * d, Window w, long l,
483 EXTERN void XWindowEvent (Display * d, Window w, long l,
484484 XEvent * x);
485485 #endif
486486 #ifndef XDestroyIC_TCL_DECLARED
496496 #ifndef XmbLookupString_TCL_DECLARED
497497 #define XmbLookupString_TCL_DECLARED
498498 /* 79 */
499 EXTERN int XmbLookupString (XIC xi, XKeyPressedEvent * xk,
499 EXTERN int XmbLookupString (XIC xi, XKeyPressedEvent * xk,
500500 char * c, int i, KeySym * k, Status * s);
501501 #endif
502502 #ifndef TkPutImage_TCL_DECLARED
503503 #define TkPutImage_TCL_DECLARED
504504 /* 80 */
505 EXTERN void TkPutImage (unsigned long * colors, int ncolors,
506 Display * display, Drawable d, GC gc,
507 XImage * image, int src_x, int src_y,
508 int dest_x, int dest_y, unsigned int width,
505 EXTERN void TkPutImage (unsigned long * colors, int ncolors,
506 Display * display, Drawable d, GC gc,
507 XImage * image, int src_x, int src_y,
508 int dest_x, int dest_y, unsigned int width,
509509 unsigned int height);
510510 #endif
511511 /* Slot 81 is reserved */
512512 #ifndef XParseColor_TCL_DECLARED
513513 #define XParseColor_TCL_DECLARED
514514 /* 82 */
515 EXTERN Status XParseColor (Display * display, Colormap map,
515 EXTERN Status XParseColor (Display * display, Colormap map,
516516 _Xconst char * spec, XColor * colorPtr);
517517 #endif
518518 #ifndef XCreateGC_TCL_DECLARED
519519 #define XCreateGC_TCL_DECLARED
520520 /* 83 */
521 EXTERN GC XCreateGC (Display * display, Drawable d,
521 EXTERN GC XCreateGC (Display * display, Drawable d,
522522 unsigned long valuemask, XGCValues * values);
523523 #endif
524524 #ifndef XFreeGC_TCL_DECLARED
529529 #ifndef XInternAtom_TCL_DECLARED
530530 #define XInternAtom_TCL_DECLARED
531531 /* 85 */
532 EXTERN Atom XInternAtom (Display * display,
533 _Xconst char * atom_name,
532 EXTERN Atom XInternAtom (Display * display,
533 _Xconst char * atom_name,
534534 Bool only_if_exists);
535535 #endif
536536 #ifndef XSetBackground_TCL_DECLARED
537537 #define XSetBackground_TCL_DECLARED
538538 /* 86 */
539 EXTERN void XSetBackground (Display * display, GC gc,
539 EXTERN void XSetBackground (Display * display, GC gc,
540540 unsigned long foreground);
541541 #endif
542542 #ifndef XSetForeground_TCL_DECLARED
543543 #define XSetForeground_TCL_DECLARED
544544 /* 87 */
545 EXTERN void XSetForeground (Display * display, GC gc,
545 EXTERN void XSetForeground (Display * display, GC gc,
546546 unsigned long foreground);
547547 #endif
548548 #ifndef XSetClipMask_TCL_DECLARED
549549 #define XSetClipMask_TCL_DECLARED
550550 /* 88 */
551 EXTERN void XSetClipMask (Display * display, GC gc,
551 EXTERN void XSetClipMask (Display * display, GC gc,
552552 Pixmap pixmap);
553553 #endif
554554 #ifndef XSetClipOrigin_TCL_DECLARED
555555 #define XSetClipOrigin_TCL_DECLARED
556556 /* 89 */
557 EXTERN void XSetClipOrigin (Display * display, GC gc,
557 EXTERN void XSetClipOrigin (Display * display, GC gc,
558558 int clip_x_origin, int clip_y_origin);
559559 #endif
560560 #ifndef XSetTSOrigin_TCL_DECLARED
561561 #define XSetTSOrigin_TCL_DECLARED
562562 /* 90 */
563 EXTERN void XSetTSOrigin (Display * display, GC gc,
563 EXTERN void XSetTSOrigin (Display * display, GC gc,
564564 int ts_x_origin, int ts_y_origin);
565565 #endif
566566 #ifndef XChangeGC_TCL_DECLARED
567567 #define XChangeGC_TCL_DECLARED
568568 /* 91 */
569 EXTERN void XChangeGC (Display * d, GC gc, unsigned long mask,
569 EXTERN void XChangeGC (Display * d, GC gc, unsigned long mask,
570570 XGCValues * values);
571571 #endif
572572 #ifndef XSetFont_TCL_DECLARED
582582 #ifndef XSetStipple_TCL_DECLARED
583583 #define XSetStipple_TCL_DECLARED
584584 /* 94 */
585 EXTERN void XSetStipple (Display * display, GC gc,
585 EXTERN void XSetStipple (Display * display, GC gc,
586586 Pixmap stipple);
587587 #endif
588588 #ifndef XSetFillRule_TCL_DECLARED
589589 #define XSetFillRule_TCL_DECLARED
590590 /* 95 */
591 EXTERN void XSetFillRule (Display * display, GC gc,
591 EXTERN void XSetFillRule (Display * display, GC gc,
592592 int fill_rule);
593593 #endif
594594 #ifndef XSetFillStyle_TCL_DECLARED
595595 #define XSetFillStyle_TCL_DECLARED
596596 /* 96 */
597 EXTERN void XSetFillStyle (Display * display, GC gc,
597 EXTERN void XSetFillStyle (Display * display, GC gc,
598598 int fill_style);
599599 #endif
600600 #ifndef XSetFunction_TCL_DECLARED
605605 #ifndef XSetLineAttributes_TCL_DECLARED
606606 #define XSetLineAttributes_TCL_DECLARED
607607 /* 98 */
608 EXTERN void XSetLineAttributes (Display * display, GC gc,
609 unsigned int line_width, int line_style,
608 EXTERN void XSetLineAttributes (Display * display, GC gc,
609 unsigned int line_width, int line_style,
610610 int cap_style, int join_style);
611611 #endif
612612 #ifndef _XInitImageFuncPtrs_TCL_DECLARED
622622 #ifndef XGetVisualInfo_TCL_DECLARED
623623 #define XGetVisualInfo_TCL_DECLARED
624624 /* 101 */
625 EXTERN XVisualInfo * XGetVisualInfo (Display * display, long vinfo_mask,
626 XVisualInfo * vinfo_template,
625 EXTERN XVisualInfo * XGetVisualInfo (Display * display, long vinfo_mask,
626 XVisualInfo * vinfo_template,
627627 int * nitems_return);
628628 #endif
629629 #ifndef XSetWMClientMachine_TCL_DECLARED
630630 #define XSetWMClientMachine_TCL_DECLARED
631631 /* 102 */
632 EXTERN void XSetWMClientMachine (Display * display, Window w,
632 EXTERN void XSetWMClientMachine (Display * display, Window w,
633633 XTextProperty * text_prop);
634634 #endif
635635 #ifndef XStringListToTextProperty_TCL_DECLARED
636636 #define XStringListToTextProperty_TCL_DECLARED
637637 /* 103 */
638 EXTERN Status XStringListToTextProperty (char ** list, int count,
638 EXTERN Status XStringListToTextProperty (char ** list, int count,
639639 XTextProperty * text_prop_return);
640640 #endif
641641 #ifndef XDrawLine_TCL_DECLARED
642642 #define XDrawLine_TCL_DECLARED
643643 /* 104 */
644 EXTERN void XDrawLine (Display * d, Drawable dr, GC g, int x1,
644 EXTERN void XDrawLine (Display * d, Drawable dr, GC g, int x1,
645645 int y1, int x2, int y2);
646646 #endif
647647 #ifndef XWarpPointer_TCL_DECLARED
648648 #define XWarpPointer_TCL_DECLARED
649649 /* 105 */
650 EXTERN void XWarpPointer (Display * d, Window s, Window dw,
651 int sx, int sy, unsigned int sw,
650 EXTERN void XWarpPointer (Display * d, Window s, Window dw,
651 int sx, int sy, unsigned int sw,
652652 unsigned int sh, int dx, int dy);
653653 #endif
654654 #ifndef XFillRectangle_TCL_DECLARED
655655 #define XFillRectangle_TCL_DECLARED
656656 /* 106 */
657 EXTERN void XFillRectangle (Display * display, Drawable d, GC gc,
658 int x, int y, unsigned int width,
657 EXTERN void XFillRectangle (Display * display, Drawable d, GC gc,
658 int x, int y, unsigned int width,
659659 unsigned int height);
660660 #endif
661661 #endif /* WIN */
663663 #ifndef XSetDashes_TCL_DECLARED
664664 #define XSetDashes_TCL_DECLARED
665665 /* 0 */
666 EXTERN void XSetDashes (Display * display, GC gc,
667 int dash_offset, _Xconst char * dash_list,
666 EXTERN void XSetDashes (Display * display, GC gc,
667 int dash_offset, _Xconst char * dash_list,
668668 int n);
669669 #endif
670670 #ifndef XGetModifierMapping_TCL_DECLARED
675675 #ifndef XCreateImage_TCL_DECLARED
676676 #define XCreateImage_TCL_DECLARED
677677 /* 2 */
678 EXTERN XImage * XCreateImage (Display * d, Visual * v,
679 unsigned int ui1, int i1, int i2, char * cp,
680 unsigned int ui2, unsigned int ui3, int i3,
678 EXTERN XImage * XCreateImage (Display * d, Visual * v,
679 unsigned int ui1, int i1, int i2, char * cp,
680 unsigned int ui2, unsigned int ui3, int i3,
681681 int i4);
682682 #endif
683683 #ifndef XGetImage_TCL_DECLARED
684684 #define XGetImage_TCL_DECLARED
685685 /* 3 */
686 EXTERN XImage * XGetImage (Display * d, Drawable dr, int i1, int i2,
687 unsigned int ui1, unsigned int ui2,
686 EXTERN XImage * XGetImage (Display * d, Drawable dr, int i1, int i2,
687 unsigned int ui1, unsigned int ui2,
688688 unsigned long ul, int i3);
689689 #endif
690690 #ifndef XGetAtomName_TCL_DECLARED
700700 #ifndef XCreateColormap_TCL_DECLARED
701701 #define XCreateColormap_TCL_DECLARED
702702 /* 6 */
703 EXTERN Colormap XCreateColormap (Display * d, Window w, Visual * v,
703 EXTERN Colormap XCreateColormap (Display * d, Window w, Visual * v,
704704 int i);
705705 #endif
706706 #ifndef XGContextFromGC_TCL_DECLARED
741741 #ifndef XChangeProperty_TCL_DECLARED
742742 #define XChangeProperty_TCL_DECLARED
743743 /* 14 */
744 EXTERN void XChangeProperty (Display * d, Window w, Atom a1,
745 Atom a2, int i1, int i2,
744 EXTERN void XChangeProperty (Display * d, Window w, Atom a1,
745 Atom a2, int i1, int i2,
746746 _Xconst unsigned char * c, int i3);
747747 #endif
748748 #ifndef XChangeWindowAttributes_TCL_DECLARED
749749 #define XChangeWindowAttributes_TCL_DECLARED
750750 /* 15 */
751 EXTERN void XChangeWindowAttributes (Display * d, Window w,
751 EXTERN void XChangeWindowAttributes (Display * d, Window w,
752752 unsigned long ul, XSetWindowAttributes * x);
753753 #endif
754754 #ifndef XConfigureWindow_TCL_DECLARED
755755 #define XConfigureWindow_TCL_DECLARED
756756 /* 16 */
757 EXTERN void XConfigureWindow (Display * d, Window w,
757 EXTERN void XConfigureWindow (Display * d, Window w,
758758 unsigned int i, XWindowChanges * x);
759759 #endif
760760 #ifndef XCopyArea_TCL_DECLARED
761761 #define XCopyArea_TCL_DECLARED
762762 /* 17 */
763 EXTERN void XCopyArea (Display * d, Drawable dr1, Drawable dr2,
764 GC g, int i1, int i2, unsigned int ui1,
763 EXTERN void XCopyArea (Display * d, Drawable dr1, Drawable dr2,
764 GC g, int i1, int i2, unsigned int ui1,
765765 unsigned int ui2, int i3, int i4);
766766 #endif
767767 #ifndef XCopyPlane_TCL_DECLARED
768768 #define XCopyPlane_TCL_DECLARED
769769 /* 18 */
770 EXTERN void XCopyPlane (Display * d, Drawable dr1, Drawable dr2,
771 GC g, int i1, int i2, unsigned int ui1,
772 unsigned int ui2, int i3, int i4,
770 EXTERN void XCopyPlane (Display * d, Drawable dr1, Drawable dr2,
771 GC g, int i1, int i2, unsigned int ui1,
772 unsigned int ui2, int i3, int i4,
773773 unsigned long ul);
774774 #endif
775775 #ifndef XCreateBitmapFromData_TCL_DECLARED
776776 #define XCreateBitmapFromData_TCL_DECLARED
777777 /* 19 */
778 EXTERN Pixmap XCreateBitmapFromData (Display * display, Drawable d,
779 _Xconst char * data, unsigned int width,
778 EXTERN Pixmap XCreateBitmapFromData (Display * display, Drawable d,
779 _Xconst char * data, unsigned int width,
780780 unsigned int height);
781781 #endif
782782 #ifndef XDefineCursor_TCL_DECLARED
792792 #ifndef XDrawArc_TCL_DECLARED
793793 #define XDrawArc_TCL_DECLARED
794794 /* 22 */
795 EXTERN void XDrawArc (Display * d, Drawable dr, GC g, int i1,
796 int i2, unsigned int ui1, unsigned int ui2,
795 EXTERN void XDrawArc (Display * d, Drawable dr, GC g, int i1,
796 int i2, unsigned int ui1, unsigned int ui2,
797797 int i3, int i4);
798798 #endif
799799 #ifndef XDrawLines_TCL_DECLARED
800800 #define XDrawLines_TCL_DECLARED
801801 /* 23 */
802 EXTERN void XDrawLines (Display * d, Drawable dr, GC g,
802 EXTERN void XDrawLines (Display * d, Drawable dr, GC g,
803803 XPoint * x, int i1, int i2);
804804 #endif
805805 #ifndef XDrawRectangle_TCL_DECLARED
806806 #define XDrawRectangle_TCL_DECLARED
807807 /* 24 */
808 EXTERN void XDrawRectangle (Display * d, Drawable dr, GC g,
809 int i1, int i2, unsigned int ui1,
808 EXTERN void XDrawRectangle (Display * d, Drawable dr, GC g,
809 int i1, int i2, unsigned int ui1,
810810 unsigned int ui2);
811811 #endif
812812 #ifndef XFillArc_TCL_DECLARED
813813 #define XFillArc_TCL_DECLARED
814814 /* 25 */
815 EXTERN void XFillArc (Display * d, Drawable dr, GC g, int i1,
816 int i2, unsigned int ui1, unsigned int ui2,
815 EXTERN void XFillArc (Display * d, Drawable dr, GC g, int i1,
816 int i2, unsigned int ui1, unsigned int ui2,
817817 int i3, int i4);
818818 #endif
819819 #ifndef XFillPolygon_TCL_DECLARED
820820 #define XFillPolygon_TCL_DECLARED
821821 /* 26 */
822 EXTERN void XFillPolygon (Display * d, Drawable dr, GC g,
822 EXTERN void XFillPolygon (Display * d, Drawable dr, GC g,
823823 XPoint * x, int i1, int i2, int i3);
824824 #endif
825825 #ifndef XFillRectangles_TCL_DECLARED
826826 #define XFillRectangles_TCL_DECLARED
827827 /* 27 */
828 EXTERN void XFillRectangles (Display * d, Drawable dr, GC g,
828 EXTERN void XFillRectangles (Display * d, Drawable dr, GC g,
829829 XRectangle * x, int i);
830830 #endif
831831 #ifndef XFreeColormap_TCL_DECLARED
836836 #ifndef XFreeColors_TCL_DECLARED
837837 #define XFreeColors_TCL_DECLARED
838838 /* 29 */
839 EXTERN void XFreeColors (Display * d, Colormap c,
839 EXTERN void XFreeColors (Display * d, Colormap c,
840840 unsigned long * ulp, int i, unsigned long ul);
841841 #endif
842842 #ifndef XFreeModifiermap_TCL_DECLARED
847847 #ifndef XGetGeometry_TCL_DECLARED
848848 #define XGetGeometry_TCL_DECLARED
849849 /* 31 */
850 EXTERN Status XGetGeometry (Display * d, Drawable dr, Window * w,
851 int * i1, int * i2, unsigned int * ui1,
852 unsigned int * ui2, unsigned int * ui3,
850 EXTERN Status XGetGeometry (Display * d, Drawable dr, Window * w,
851 int * i1, int * i2, unsigned int * ui1,
852 unsigned int * ui2, unsigned int * ui3,
853853 unsigned int * ui4);
854854 #endif
855855 #ifndef XGetWindowProperty_TCL_DECLARED
856856 #define XGetWindowProperty_TCL_DECLARED
857857 /* 32 */
858 EXTERN int XGetWindowProperty (Display * d, Window w, Atom a1,
859 long l1, long l2, Bool b, Atom a2, Atom * ap,
860 int * ip, unsigned long * ulp1,
858 EXTERN int XGetWindowProperty (Display * d, Window w, Atom a1,
859 long l1, long l2, Bool b, Atom a2, Atom * ap,
860 int * ip, unsigned long * ulp1,
861861 unsigned long * ulp2, unsigned char ** cpp);
862862 #endif
863863 #ifndef XGrabKeyboard_TCL_DECLARED
864864 #define XGrabKeyboard_TCL_DECLARED
865865 /* 33 */
866 EXTERN int XGrabKeyboard (Display * d, Window w, Bool b, int i1,
866 EXTERN int XGrabKeyboard (Display * d, Window w, Bool b, int i1,
867867 int i2, Time t);
868868 #endif
869869 #ifndef XGrabPointer_TCL_DECLARED
870870 #define XGrabPointer_TCL_DECLARED
871871 /* 34 */
872 EXTERN int XGrabPointer (Display * d, Window w1, Bool b,
873 unsigned int ui, int i1, int i2, Window w2,
872 EXTERN int XGrabPointer (Display * d, Window w1, Bool b,
873 unsigned int ui, int i1, int i2, Window w2,
874874 Cursor c, Time t);
875875 #endif
876876 #ifndef XKeysymToKeycode_TCL_DECLARED
886886 #ifndef XMoveResizeWindow_TCL_DECLARED
887887 #define XMoveResizeWindow_TCL_DECLARED
888888 /* 37 */
889 EXTERN void XMoveResizeWindow (Display * d, Window w, int i1,
889 EXTERN void XMoveResizeWindow (Display * d, Window w, int i1,
890890 int i2, unsigned int ui1, unsigned int ui2);
891891 #endif
892892 #ifndef XMoveWindow_TCL_DECLARED
897897 #ifndef XQueryPointer_TCL_DECLARED
898898 #define XQueryPointer_TCL_DECLARED
899899 /* 39 */
900 EXTERN Bool XQueryPointer (Display * d, Window w1, Window * w2,
901 Window * w3, int * i1, int * i2, int * i3,
900 EXTERN Bool XQueryPointer (Display * d, Window w1, Window * w2,
901 Window * w3, int * i1, int * i2, int * i3,
902902 int * i4, unsigned int * ui);
903903 #endif
904904 #ifndef XRaiseWindow_TCL_DECLARED
914914 #ifndef XResizeWindow_TCL_DECLARED
915915 #define XResizeWindow_TCL_DECLARED
916916 /* 42 */
917 EXTERN void XResizeWindow (Display * d, Window w,
917 EXTERN void XResizeWindow (Display * d, Window w,
918918 unsigned int ui1, unsigned int ui2);
919919 #endif
920920 #ifndef XSelectInput_TCL_DECLARED
925925 #ifndef XSendEvent_TCL_DECLARED
926926 #define XSendEvent_TCL_DECLARED
927927 /* 44 */
928 EXTERN Status XSendEvent (Display * d, Window w, Bool b, long l,
928 EXTERN Status XSendEvent (Display * d, Window w, Bool b, long l,
929929 XEvent * x);
930930 #endif
931931 #ifndef XSetIconName_TCL_DECLARED
932932 #define XSetIconName_TCL_DECLARED
933933 /* 45 */
934 EXTERN void XSetIconName (Display * d, Window w,
934 EXTERN void XSetIconName (Display * d, Window w,
935935 _Xconst char * c);
936936 #endif
937937 #ifndef XSetInputFocus_TCL_DECLARED
942942 #ifndef XSetSelectionOwner_TCL_DECLARED
943943 #define XSetSelectionOwner_TCL_DECLARED
944944 /* 47 */
945 EXTERN void XSetSelectionOwner (Display * d, Atom a, Window w,
945 EXTERN void XSetSelectionOwner (Display * d, Atom a, Window w,
946946 Time t);
947947 #endif
948948 #ifndef XSetWindowBackground_TCL_DECLARED
949949 #define XSetWindowBackground_TCL_DECLARED
950950 /* 48 */
951 EXTERN void XSetWindowBackground (Display * d, Window w,
951 EXTERN void XSetWindowBackground (Display * d, Window w,
952952 unsigned long ul);
953953 #endif
954954 #ifndef XSetWindowBackgroundPixmap_TCL_DECLARED
955955 #define XSetWindowBackgroundPixmap_TCL_DECLARED
956956 /* 49 */
957 EXTERN void XSetWindowBackgroundPixmap (Display * d, Window w,
957 EXTERN void XSetWindowBackgroundPixmap (Display * d, Window w,
958958 Pixmap p);
959959 #endif
960960 #ifndef XSetWindowBorder_TCL_DECLARED
961961 #define XSetWindowBorder_TCL_DECLARED
962962 /* 50 */
963 EXTERN void XSetWindowBorder (Display * d, Window w,
963 EXTERN void XSetWindowBorder (Display * d, Window w,
964964 unsigned long ul);
965965 #endif
966966 #ifndef XSetWindowBorderPixmap_TCL_DECLARED
967967 #define XSetWindowBorderPixmap_TCL_DECLARED
968968 /* 51 */
969 EXTERN void XSetWindowBorderPixmap (Display * d, Window w,
969 EXTERN void XSetWindowBorderPixmap (Display * d, Window w,
970970 Pixmap p);
971971 #endif
972972 #ifndef XSetWindowBorderWidth_TCL_DECLARED
973973 #define XSetWindowBorderWidth_TCL_DECLARED
974974 /* 52 */
975 EXTERN void XSetWindowBorderWidth (Display * d, Window w,
975 EXTERN void XSetWindowBorderWidth (Display * d, Window w,
976976 unsigned int ui);
977977 #endif
978978 #ifndef XSetWindowColormap_TCL_DECLARED
979979 #define XSetWindowColormap_TCL_DECLARED
980980 /* 53 */
981 EXTERN void XSetWindowColormap (Display * d, Window w,
981 EXTERN void XSetWindowColormap (Display * d, Window w,
982982 Colormap c);
983983 #endif
984984 #ifndef XUngrabKeyboard_TCL_DECLARED
999999 #ifndef TkPutImage_TCL_DECLARED
10001000 #define TkPutImage_TCL_DECLARED
10011001 /* 57 */
1002 EXTERN void TkPutImage (unsigned long * colors, int ncolors,
1003 Display * display, Drawable d, GC gc,
1004 XImage * image, int src_x, int src_y,
1005 int dest_x, int dest_y, unsigned int width,
1002 EXTERN void TkPutImage (unsigned long * colors, int ncolors,
1003 Display * display, Drawable d, GC gc,
1004 XImage * image, int src_x, int src_y,
1005 int dest_x, int dest_y, unsigned int width,
10061006 unsigned int height);
10071007 #endif
10081008 #ifndef XParseColor_TCL_DECLARED
10091009 #define XParseColor_TCL_DECLARED
10101010 /* 58 */
1011 EXTERN Status XParseColor (Display * display, Colormap map,
1011 EXTERN Status XParseColor (Display * display, Colormap map,
10121012 _Xconst char * spec, XColor * colorPtr);
10131013 #endif
10141014 #ifndef XCreateGC_TCL_DECLARED
10151015 #define XCreateGC_TCL_DECLARED
10161016 /* 59 */
1017 EXTERN GC XCreateGC (Display * display, Drawable d,
1017 EXTERN GC XCreateGC (Display * display, Drawable d,
10181018 unsigned long valuemask, XGCValues * values);
10191019 #endif
10201020 #ifndef XFreeGC_TCL_DECLARED
10251025 #ifndef XInternAtom_TCL_DECLARED
10261026 #define XInternAtom_TCL_DECLARED
10271027 /* 61 */
1028 EXTERN Atom XInternAtom (Display * display,
1029 _Xconst char * atom_name,
1028 EXTERN Atom XInternAtom (Display * display,
1029 _Xconst char * atom_name,
10301030 Bool only_if_exists);
10311031 #endif
10321032 #ifndef XSetBackground_TCL_DECLARED
10331033 #define XSetBackground_TCL_DECLARED
10341034 /* 62 */
1035 EXTERN void XSetBackground (Display * display, GC gc,
1035 EXTERN void XSetBackground (Display * display, GC gc,
10361036 unsigned long foreground);
10371037 #endif
10381038 #ifndef XSetForeground_TCL_DECLARED
10391039 #define XSetForeground_TCL_DECLARED
10401040 /* 63 */
1041 EXTERN void XSetForeground (Display * display, GC gc,
1041 EXTERN void XSetForeground (Display * display, GC gc,
10421042 unsigned long foreground);
10431043 #endif
10441044 #ifndef XSetClipMask_TCL_DECLARED
10451045 #define XSetClipMask_TCL_DECLARED
10461046 /* 64 */
1047 EXTERN void XSetClipMask (Display * display, GC gc,
1047 EXTERN void XSetClipMask (Display * display, GC gc,
10481048 Pixmap pixmap);
10491049 #endif
10501050 #ifndef XSetClipOrigin_TCL_DECLARED
10511051 #define XSetClipOrigin_TCL_DECLARED
10521052 /* 65 */
1053 EXTERN void XSetClipOrigin (Display * display, GC gc,
1053 EXTERN void XSetClipOrigin (Display * display, GC gc,
10541054 int clip_x_origin, int clip_y_origin);
10551055 #endif
10561056 #ifndef XSetTSOrigin_TCL_DECLARED
10571057 #define XSetTSOrigin_TCL_DECLARED
10581058 /* 66 */
1059 EXTERN void XSetTSOrigin (Display * display, GC gc,
1059 EXTERN void XSetTSOrigin (Display * display, GC gc,
10601060 int ts_x_origin, int ts_y_origin);
10611061 #endif
10621062 #ifndef XChangeGC_TCL_DECLARED
10631063 #define XChangeGC_TCL_DECLARED
10641064 /* 67 */
1065 EXTERN void XChangeGC (Display * d, GC gc, unsigned long mask,
1065 EXTERN void XChangeGC (Display * d, GC gc, unsigned long mask,
10661066 XGCValues * values);
10671067 #endif
10681068 #ifndef XSetFont_TCL_DECLARED
10781078 #ifndef XSetStipple_TCL_DECLARED
10791079 #define XSetStipple_TCL_DECLARED
10801080 /* 70 */
1081 EXTERN void XSetStipple (Display * display, GC gc,
1081 EXTERN void XSetStipple (Display * display, GC gc,
10821082 Pixmap stipple);
10831083 #endif
10841084 #ifndef XSetFillRule_TCL_DECLARED
10851085 #define XSetFillRule_TCL_DECLARED
10861086 /* 71 */
1087 EXTERN void XSetFillRule (Display * display, GC gc,
1087 EXTERN void XSetFillRule (Display * display, GC gc,
10881088 int fill_rule);
10891089 #endif
10901090 #ifndef XSetFillStyle_TCL_DECLARED
10911091 #define XSetFillStyle_TCL_DECLARED
10921092 /* 72 */
1093 EXTERN void XSetFillStyle (Display * display, GC gc,
1093 EXTERN void XSetFillStyle (Display * display, GC gc,
10941094 int fill_style);
10951095 #endif
10961096 #ifndef XSetFunction_TCL_DECLARED
11011101 #ifndef XSetLineAttributes_TCL_DECLARED
11021102 #define XSetLineAttributes_TCL_DECLARED
11031103 /* 74 */
1104 EXTERN void XSetLineAttributes (Display * display, GC gc,
1105 unsigned int line_width, int line_style,
1104 EXTERN void XSetLineAttributes (Display * display, GC gc,
1105 unsigned int line_width, int line_style,
11061106 int cap_style, int join_style);
11071107 #endif
11081108 #ifndef _XInitImageFuncPtrs_TCL_DECLARED
11181118 #ifndef XGetVisualInfo_TCL_DECLARED
11191119 #define XGetVisualInfo_TCL_DECLARED
11201120 /* 77 */
1121 EXTERN XVisualInfo * XGetVisualInfo (Display * display, long vinfo_mask,
1122 XVisualInfo * vinfo_template,
1121 EXTERN XVisualInfo * XGetVisualInfo (Display * display, long vinfo_mask,
1122 XVisualInfo * vinfo_template,
11231123 int * nitems_return);
11241124 #endif
11251125 #ifndef XSetWMClientMachine_TCL_DECLARED
11261126 #define XSetWMClientMachine_TCL_DECLARED
11271127 /* 78 */
1128 EXTERN void XSetWMClientMachine (Display * display, Window w,
1128 EXTERN void XSetWMClientMachine (Display * display, Window w,
11291129 XTextProperty * text_prop);
11301130 #endif
11311131 #ifndef XStringListToTextProperty_TCL_DECLARED
11321132 #define XStringListToTextProperty_TCL_DECLARED
11331133 /* 79 */
1134 EXTERN Status XStringListToTextProperty (char ** list, int count,
1134 EXTERN Status XStringListToTextProperty (char ** list, int count,
11351135 XTextProperty * text_prop_return);
11361136 #endif
11371137 #ifndef XDrawSegments_TCL_DECLARED
11381138 #define XDrawSegments_TCL_DECLARED
11391139 /* 80 */
1140 EXTERN void XDrawSegments (Display * display, Drawable d, GC gc,
1140 EXTERN void XDrawSegments (Display * display, Drawable d, GC gc,
11411141 XSegment * segments, int nsegments);
11421142 #endif
11431143 #ifndef XForceScreenSaver_TCL_DECLARED
11481148 #ifndef XDrawLine_TCL_DECLARED
11491149 #define XDrawLine_TCL_DECLARED
11501150 /* 82 */
1151 EXTERN void XDrawLine (Display * d, Drawable dr, GC g, int x1,
1151 EXTERN void XDrawLine (Display * d, Drawable dr, GC g, int x1,
11521152 int y1, int x2, int y2);
11531153 #endif
11541154 #ifndef XFillRectangle_TCL_DECLARED
11551155 #define XFillRectangle_TCL_DECLARED
11561156 /* 83 */
1157 EXTERN void XFillRectangle (Display * display, Drawable d, GC gc,
1158 int x, int y, unsigned int width,
1157 EXTERN void XFillRectangle (Display * display, Drawable d, GC gc,
1158 int x, int y, unsigned int width,
11591159 unsigned int height);
11601160 #endif
11611161 #ifndef XClearWindow_TCL_DECLARED
11661166 #ifndef XDrawPoint_TCL_DECLARED
11671167 #define XDrawPoint_TCL_DECLARED
11681168 /* 85 */
1169 EXTERN void XDrawPoint (Display * display, Drawable d, GC gc,
1169 EXTERN void XDrawPoint (Display * display, Drawable d, GC gc,
11701170 int x, int y);
11711171 #endif
11721172 #ifndef XDrawPoints_TCL_DECLARED
11731173 #define XDrawPoints_TCL_DECLARED
11741174 /* 86 */
1175 EXTERN void XDrawPoints (Display * display, Drawable d, GC gc,
1175 EXTERN void XDrawPoints (Display * display, Drawable d, GC gc,
11761176 XPoint * points, int npoints, int mode);
11771177 #endif
11781178 #ifndef XWarpPointer_TCL_DECLARED
11791179 #define XWarpPointer_TCL_DECLARED
11801180 /* 87 */
1181 EXTERN void XWarpPointer (Display * display, Window src_w,
1182 Window dest_w, int src_x, int src_y,
1183 unsigned int src_width,
1184 unsigned int src_height, int dest_x,
1181 EXTERN void XWarpPointer (Display * display, Window src_w,
1182 Window dest_w, int src_x, int src_y,
1183 unsigned int src_width,
1184 unsigned int src_height, int dest_x,
11851185 int dest_y);
11861186 #endif
11871187 #ifndef XQueryColor_TCL_DECLARED
11881188 #define XQueryColor_TCL_DECLARED
11891189 /* 88 */
1190 EXTERN void XQueryColor (Display * display, Colormap colormap,
1190 EXTERN void XQueryColor (Display * display, Colormap colormap,
11911191 XColor * def_in_out);
11921192 #endif
11931193 #ifndef XQueryColors_TCL_DECLARED
11941194 #define XQueryColors_TCL_DECLARED
11951195 /* 89 */
1196 EXTERN void XQueryColors (Display * display, Colormap colormap,
1196 EXTERN void XQueryColors (Display * display, Colormap colormap,
11971197 XColor * defs_in_out, int ncolors);
11981198 #endif
11991199 #ifndef XQueryTree_TCL_DECLARED
12001200 #define XQueryTree_TCL_DECLARED
12011201 /* 90 */
1202 EXTERN Status XQueryTree (Display * d, Window w1, Window * w2,
1202 EXTERN Status XQueryTree (Display * d, Window w1, Window * w2,
12031203 Window * w3, Window ** w4, unsigned int * ui);
12041204 #endif
12051205 #ifndef XSync_TCL_DECLARED
12111211
12121212 typedef struct TkIntXlibStubs {
12131213 int magic;
1214 CONST struct TkIntXlibStubHooks *hooks;
1214 const struct TkIntXlibStubHooks *hooks;
12151215
12161216 #ifdef __WIN32__ /* WIN */
12171217 void (*xSetDashes) (Display * display, GC gc, int dash_offset, _Xconst char * dash_list, int n); /* 0 */
12761276 void (*xResizeWindow) (Display * d, Window w, unsigned int ui1, unsigned int ui2); /* 59 */
12771277 void (*xSelectInput) (Display * d, Window w, long l); /* 60 */
12781278 Status (*xSendEvent) (Display * d, Window w, Bool b, long l, XEvent * x); /* 61 */
1279 void (*xSetCommand) (Display * d, Window w, CONST char ** c, int i); /* 62 */
1279 void (*xSetCommand) (Display * d, Window w, const char ** c, int i); /* 62 */
12801280 void (*xSetIconName) (Display * d, Window w, _Xconst char * c); /* 63 */
12811281 void (*xSetInputFocus) (Display * d, Window w, int i, Time t); /* 64 */
12821282 void (*xSetSelectionOwner) (Display * d, Atom a, Window w, Time t); /* 65 */
14191419 } TkIntXlibStubs;
14201420
14211421 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
1422 extern CONST TkIntXlibStubs *tkIntXlibStubsPtr;
1422 extern const TkIntXlibStubs *tkIntXlibStubsPtr;
14231423 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
14241424
14251425 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkListbox.c,v 1.49 2008/10/09 21:21:03 dgp Exp $
13 * RCS: @(#) $Id: tkListbox.c,v 1.54 2008/12/09 21:22:56 dgp Exp $
1414 */
1515
1616 #include "default.h"
212212 STATE_DISABLED, STATE_NORMAL
213213 };
214214
215 static char *stateStrings[] = {
215 static const char *const stateStrings[] = {
216216 "disabled", "normal", NULL
217217 };
218218
220220 ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE
221221 };
222222
223 static char *activeStyleStrings[] = {
223 static const char *const activeStyleStrings[] = {
224224 "dotbox", "none", "underline", NULL
225225 };
226226
339339 * dispatch the listbox widget command.
340340 */
341341
342 static const char *commandNames[] = {
342 static const char *const commandNames[] = {
343343 "activate", "bbox", "cget", "configure", "curselection", "delete", "get",
344344 "index", "insert", "itemcget", "itemconfigure", "nearest", "scan",
345345 "see", "selection", "size", "xview", "yview", NULL
352352 COMMAND_SIZE, COMMAND_XVIEW, COMMAND_YVIEW
353353 };
354354
355 static const char *selCommandNames[] = {
355 static const char *const selCommandNames[] = {
356356 "anchor", "clear", "includes", "set", NULL
357357 };
358358 enum selcommand {
359359 SELECTION_ANCHOR, SELECTION_CLEAR, SELECTION_INCLUDES, SELECTION_SET
360360 };
361361
362 static const char *scanCommandNames[] = {
362 static const char *const scanCommandNames[] = {
363363 "mark", "dragto", NULL
364364 };
365365 enum scancommand {
366366 SCAN_MARK, SCAN_DRAGTO
367367 };
368368
369 static const char *indexNames[] = {
369 static const char *const indexNames[] = {
370370 "active", "anchor", "end", NULL
371371 };
372372 enum indices {
567567 return TCL_ERROR;
568568 }
569569
570 Tcl_SetResult(interp, Tk_PathName(listPtr->tkwin), TCL_STATIC);
570 Tcl_SetObjResult(interp, TkNewWindowObj(listPtr->tkwin));
571571 return TCL_OK;
572572 }
573573
693693 if (objPtr == NULL) {
694694 result = TCL_ERROR;
695695 break;
696 } else {
697 Tcl_SetObjResult(interp, objPtr);
698 result = TCL_OK;
699696 }
697 Tcl_SetObjResult(interp, objPtr);
698 result = TCL_OK;
700699 } else {
701700 result = ConfigureListbox(interp, listPtr, objc-2, objv+2, 0);
702701 }
10931092 */
10941093
10951094 if ((listPtr->topIndex <= index) && (index < lastVisibleIndex)) {
1096 char buf[TCL_INTEGER_SPACE * 4];
10971095 Tcl_Obj *el;
10981096 char *stringRep;
10991097 int pixelWidth, stringLen, x, y, result;
11151113 x = listPtr->inset + listPtr->selBorderWidth - listPtr->xOffset;
11161114 y = ((index - listPtr->topIndex)*listPtr->lineHeight)
11171115 + listPtr->inset + listPtr->selBorderWidth;
1118 sprintf(buf, "%d %d %d %d", x, y, pixelWidth, fm.linespace);
1119 Tcl_SetResult(interp, buf, TCL_VOLATILE);
1116 Tcl_SetObjResult(interp, Tcl_ObjPrintf("%d %d %d %d",
1117 x, y, pixelWidth, fm.linespace));
11201118 }
11211119 return TCL_OK;
11221120 }
12391237
12401238 int index, count, type, windowWidth, windowUnits;
12411239 int offset = 0; /* Initialized to stop gcc warnings. */
1242 double fraction, fraction2;
1240 double fraction;
12431241
12441242 windowWidth = Tk_Width(listPtr->tkwin)
12451243 - 2*(listPtr->inset + listPtr->selBorderWidth);
12471245 if (listPtr->maxWidth == 0) {
12481246 Tcl_SetResult(interp, "0.0 1.0", TCL_STATIC);
12491247 } else {
1250 char buf[TCL_DOUBLE_SPACE];
1248 double fraction2;
12511249
12521250 fraction = listPtr->xOffset/((double) listPtr->maxWidth);
12531251 fraction2 = (listPtr->xOffset + windowWidth)
12551253 if (fraction2 > 1.0) {
12561254 fraction2 = 1.0;
12571255 }
1258 Tcl_PrintDouble(NULL, fraction, buf);
1259 Tcl_SetResult(interp, buf, TCL_VOLATILE);
1260 Tcl_PrintDouble(NULL, fraction2, buf);
1261 Tcl_AppendResult(interp, " ", buf, NULL);
1256 Tcl_SetObjResult(interp, Tcl_ObjPrintf("%g %g",
1257 fraction, fraction2));
12621258 }
12631259 } else if (objc == 3) {
12641260 if (Tcl_GetIntFromObj(interp, objv[2], &index) != TCL_OK) {
13151311 Tcl_Obj *const objv[]) /* Array of arguments to the procedure */
13161312 {
13171313 int index, count, type;
1318 double fraction, fraction2;
1314 double fraction;
13191315
13201316 if (objc == 2) {
13211317 if (listPtr->nElements == 0) {
13221318 Tcl_SetResult(interp, "0.0 1.0", TCL_STATIC);
13231319 } else {
1324 char buf[TCL_DOUBLE_SPACE];
1325
1326 fraction = listPtr->topIndex/((double) listPtr->nElements);
1327 fraction2 = (listPtr->topIndex+listPtr->fullLines)
1328 /((double) listPtr->nElements);
1320 double fraction2, numEls = (double) listPtr->nElements;
1321
1322 fraction = listPtr->topIndex / numEls;
1323 fraction2 = (listPtr->topIndex+listPtr->fullLines) / numEls;
13291324 if (fraction2 > 1.0) {
13301325 fraction2 = 1.0;
13311326 }
1332 Tcl_PrintDouble(NULL, fraction, buf);
1333 Tcl_SetResult(interp, buf, TCL_VOLATILE);
1334 Tcl_PrintDouble(NULL, fraction2, buf);
1335 Tcl_AppendResult(interp, " ", buf, NULL);
1327 Tcl_SetObjResult(interp, Tcl_ObjPrintf("%g %g",
1328 fraction, fraction2));
13361329 }
13371330 } else if (objc == 3) {
13381331 if (GetListboxIndex(interp, listPtr, objv[2], 0, &index) != TCL_OK) {
13421335 } else {
13431336 type = Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count);
13441337 switch (type) {
1345 case TK_SCROLL_ERROR:
1346 return TCL_ERROR;
13471338 case TK_SCROLL_MOVETO:
13481339 index = (int) (listPtr->nElements*fraction + 0.5);
13491340 break;
13571348 case TK_SCROLL_UNITS:
13581349 index = listPtr->topIndex + count;
13591350 break;
1351 case TK_SCROLL_ERROR:
1352 default:
1353 return TCL_ERROR;
13601354 }
13611355 ChangeListboxView(listPtr, index);
13621356 }
32813275 if (result != TCL_OK) {
32823276 Tcl_AddErrorInfo(interp,
32833277 "\n (vertical scrolling command executed by listbox)");
3284 Tcl_BackgroundError(interp);
3278 Tcl_BackgroundException(interp, result);
32853279 }
32863280 Tcl_Release(interp);
32873281 }
33463340 if (result != TCL_OK) {
33473341 Tcl_AddErrorInfo(interp,
33483342 "\n (horizontal scrolling command executed by listbox)");
3349 Tcl_BackgroundError(interp);
3343 Tcl_BackgroundException(interp, result);
33503344 }
33513345 Tcl_Release(interp);
33523346 }
34073401 if (Tcl_ListObjLength(listPtr->interp, varListObj, &i) != TCL_OK) {
34083402 Tcl_SetVar2Ex(interp, listPtr->listVarName, NULL, oldListObj,
34093403 TCL_GLOBAL_ONLY);
3410 return "invalid listvar value";
3404 return (char *) "invalid listvar value";
34113405 }
34123406
34133407 listPtr->listObj = varListObj;
1212 * See the file "license.terms" for information on usage and redistribution of
1313 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1414 *
15 * RCS: @(#) $Id: tkMain.c,v 1.30 2008/04/27 22:38:56 dkf Exp $
15 * RCS: @(#) $Id: tkMain.c,v 1.32 2008/12/15 16:17:18 dgp Exp $
1616 */
1717
1818 #include <ctype.h>
1919 #include <stdio.h>
2020 #include <string.h>
21 #include "tclInt.h"
2221 #include "tkInt.h"
2322 #ifdef NO_STDLIB_H
2423 # include "../compat/stdlib.h"
254253 * Invoke application-specific initialization.
255254 */
256255
257 if ((*appInitProc)(interp) != TCL_OK) {
256 if (appInitProc(interp) != TCL_OK) {
258257 TkpDisplayWarning(Tcl_GetStringResult(interp),
259258 "Application initialization failed");
260259 }
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkMenu.c,v 1.44 2008/10/05 18:22:21 dkf Exp $
14 * RCS: @(#) $Id: tkMenu.c,v 1.48 2008/11/27 23:26:05 nijtmans Exp $
1515 */
1616
1717 /*
9898 * to update code in TkpMenuInit that changes the font string entry.
9999 */
100100
101 char *tkMenuStateStrings[] = {"active", "normal", "disabled", NULL};
102
103 static const char *menuEntryTypeStrings[] = {
101 static const char *const menuStateStrings[] = {"active", "normal", "disabled", NULL};
102
103 static const char *const menuEntryTypeStrings[] = {
104104 "cascade", "checkbutton", "command", "radiobutton", "separator", NULL
105105 };
106106
109109 * is used with the "enum compound" declaration in tkMenu.h
110110 */
111111
112 static char *compoundStrings[] = {
112 static const char *const compoundStrings[] = {
113113 "bottom", "center", "left", "none", "right", "top", NULL
114114 };
115115
156156 {TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
157157 DEF_MENU_ENTRY_STATE,
158158 -1, Tk_Offset(TkMenuEntry, state), 0,
159 (ClientData) tkMenuStateStrings},
159 (ClientData) menuStateStrings},
160160 {TK_OPTION_INT, "-underline", NULL, NULL,
161161 DEF_MENU_ENTRY_UNDERLINE, -1, Tk_Offset(TkMenuEntry, underline)},
162162 {TK_OPTION_END}
226226 Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK},
227227 {TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
228228 DEF_MENU_ENTRY_STATE, -1, Tk_Offset(TkMenuEntry, state), 0,
229 (ClientData) tkMenuStateStrings},
229 (ClientData) menuStateStrings},
230230 {TK_OPTION_END}
231231 };
232232
240240 * Menu type strings for use with Tcl_GetIndexFromObj.
241241 */
242242
243 static const char *menuTypeStrings[] = {
243 static const char *const menuTypeStrings[] = {
244244 "normal", "tearoff", "menubar", NULL
245245 };
246246
309309 * with MenuWidgetObjCmd.
310310 */
311311
312 static const char *menuOptions[] = {
312 static const char *const menuOptions[] = {
313313 "activate", "add", "cget", "clone", "configure", "delete", "entrycget",
314314 "entryconfigure", "index", "insert", "invoke", "post", "postcascade",
315315 "type", "unpost", "xposition", "yposition", NULL
454454 TkMenuReferences *menuRefPtr;
455455 int i, index, toplevel;
456456 char *windowName;
457 static const char *typeStringList[] = {"-type", NULL};
457 static const char *const typeStringList[] = {"-type", NULL};
458458 TkMenuOptionTables *optionTablesPtr = clientData;
459459
460460 if (objc < 2) {
632632 }
633633 }
634634
635 Tcl_SetResult(interp, Tk_PathName(menuPtr->tkwin), TCL_STATIC);
635 Tcl_SetObjResult(interp, TkNewWindowObj(menuPtr->tkwin));
636636 return TCL_OK;
637637 }
638638
21532153 *indexPtr = i;
21542154 goto success;
21552155 }
2156 Tcl_SetResult(interp, NULL, TCL_STATIC);
2156 Tcl_ResetResult(interp);
21572157 }
21582158
21592159 for (i = 0; i < menuPtr->numEntries; i++) {
29552955 return TCL_OK;
29562956
29572957 error:
2958 Tcl_SetResult(interp, NULL, TCL_STATIC);
2958 Tcl_ResetResult(interp);
29592959 return TCL_ERROR;
29602960 }
29612961
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkMenu.h,v 1.14 2007/12/13 15:24:16 dgp Exp $
11 * RCS: @(#) $Id: tkMenu.h,v 1.15 2008/10/17 23:18:37 nijtmans Exp $
1212 */
1313
1414 #ifndef _TKMENU
239239 /*
240240 * Menu states
241241 */
242
243 MODULE_SCOPE char *tkMenuStateStrings[];
244242
245243 #define ENTRY_ACTIVE 0
246244 #define ENTRY_NORMAL 1
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkMenubutton.c,v 1.22 2008/10/05 18:22:21 dkf Exp $
12 * RCS: @(#) $Id: tkMenubutton.c,v 1.24 2008/11/08 22:52:29 dkf Exp $
1313 */
1414
1515 #include "tkInt.h"
2121 * is used together with the "enum direction" declaration in tkMenubutton.h.
2222 */
2323
24 static char *directionStrings[] = {
24 static const char *const directionStrings[] = {
2525 "above", "below", "flush", "left", "right", NULL
2626 };
2727
3030 * used together with the "enum state" declaration in tkMenubutton.h.
3131 */
3232
33 static char *stateStrings[] = {
33 static const char *const stateStrings[] = {
3434 "active", "disabled", "normal", NULL
3535 };
3636
3939 * is used with the "enum compound" declaration in tkMenuButton.h
4040 */
4141
42 static char *compoundStrings[] = {
42 static const char *const compoundStrings[] = {
4343 "bottom", "center", "left", "none", "right", "top", NULL
4444 };
4545
152152 * dispatch the scale widget command.
153153 */
154154
155 static const char *commandNames[] = {
155 static const char *const commandNames[] = {
156156 "cget", "configure", NULL
157157 };
158158
307307 return TCL_ERROR;
308308 }
309309
310 Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(mbPtr->tkwin), -1));
310 Tcl_SetObjResult(interp, TkNewWindowObj(mbPtr->tkwin));
311311 return TCL_OK;
312312 }
313313
362362 mbPtr->optionTable, objv[2], mbPtr->tkwin);
363363 if (objPtr == NULL) {
364364 goto error;
365 } else {
366 Tcl_SetObjResult(interp, objPtr);
367 }
365 }
366 Tcl_SetObjResult(interp, objPtr);
368367 break;
369368
370369 case COMMAND_CONFIGURE:
374373 mbPtr->tkwin);
375374 if (objPtr == NULL) {
376375 goto error;
377 } else {
378 Tcl_SetObjResult(interp, objPtr);
379376 }
377 Tcl_SetObjResult(interp, objPtr);
380378 } else {
381379 result = ConfigureMenuButton(interp, mbPtr, objc-2, objv+2);
382380 }
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkMessage.c,v 1.21 2008/07/23 23:24:23 nijtmans Exp $
14 * RCS: @(#) $Id: tkMessage.c,v 1.22 2008/10/17 23:18:37 nijtmans Exp $
1515 */
1616
1717 #include "default.h"
306306 Tcl_Obj *const objv[]) /* Argument strings. */
307307 {
308308 register Message *msgPtr = clientData;
309 static const char *optionStrings[] = { "cget", "configure", NULL };
309 static const char *const optionStrings[] = { "cget", "configure", NULL };
310310 enum options { MESSAGE_CGET, MESSAGE_CONFIGURE };
311311 int index;
312312 int result = TCL_OK;
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkObj.c,v 1.20 2008/04/27 22:38:56 dkf Exp $
10 * RCS: @(#) $Id: tkObj.c,v 1.25 2008/11/29 00:12:58 ferrieux Exp $
1111 */
1212
1313 #include "tkInt.h"
3535
3636 #define SET_COMPLEXPIXEL(objPtr, repPtr) \
3737 (objPtr)->internalRep.twoPtrValue.ptr1 = 0; \
38 (objPtr)->internalRep.twoPtrValue.ptr2 = (void *) repPtr
38 (objPtr)->internalRep.twoPtrValue.ptr2 = repPtr
3939
4040 #define GET_COMPLEXPIXEL(objPtr) \
4141 ((PixelRep *) (objPtr)->internalRep.twoPtrValue.ptr2)
8686 * initial display-independant settings.
8787 */
8888
89 static Tcl_ObjType pixelObjType = {
89 static const Tcl_ObjType pixelObjType = {
9090 "pixel", /* name */
9191 FreePixelInternalRep, /* freeIntRepProc */
9292 DupPixelInternalRep, /* dupIntRepProc */
100100 * initial display-independant settings.
101101 */
102102
103 static Tcl_ObjType mmObjType = {
103 static const Tcl_ObjType mmObjType = {
104104 "mm", /* name */
105105 FreeMMInternalRep, /* freeIntRepProc */
106106 DupMMInternalRep, /* dupIntRepProc */
113113 * Tcl object.
114114 */
115115
116 static Tcl_ObjType windowObjType = {
116 static const Tcl_ObjType windowObjType = {
117117 "window", /* name */
118118 FreeWindowInternalRep, /* freeIntRepProc */
119119 DupWindowInternalRep, /* dupIntRepProc */
124124 /*
125125 *----------------------------------------------------------------------
126126 *
127 * Tk_GetPixelsFromObj --
127 * GetPixelsFromObjEx --
128128 *
129129 * Attempt to return a pixel value from the Tcl object "objPtr". If the
130130 * object is not already a pixel value, an attempt will be made to
142142 *----------------------------------------------------------------------
143143 */
144144
145 static
145146 int
146 Tk_GetPixelsFromObj(
147 GetPixelsFromObjEx(
147148 Tcl_Interp *interp, /* Used for error reporting if not NULL. */
148149 Tk_Window tkwin,
149150 Tcl_Obj *objPtr, /* The object from which to get pixels. */
150 int *intPtr) /* Place to store resulting pixels. */
151 {
152 int result;
151 int *intPtr,
152 double *dblPtr) /* Places to store resulting pixels. */
153 {
154 int result,fresh;
153155 double d;
154156 PixelRep *pixelPtr;
155157 static double bias[] = {
156158 1.0, 10.0, 25.4, 0.35278 /*25.4 / 72.0*/
157159 };
158160
161 retry:
159162 if (objPtr->typePtr != &pixelObjType) {
160163 result = SetPixelFromAny(interp, objPtr);
161164 if (result != TCL_OK) {
162165 return result;
163166 }
167 fresh=1;
168 } else {
169 fresh=0;
164170 }
165171
166172 if (SIMPLE_PIXELREP(objPtr)) {
167173 *intPtr = GET_SIMPLEPIXEL(objPtr);
174 if (dblPtr) {
175 *dblPtr=(double)(*intPtr);
176 }
168177 } else {
169178 pixelPtr = GET_COMPLEXPIXEL(objPtr);
170 if (pixelPtr->tkwin != tkwin) {
179 if ((!fresh) && (pixelPtr->tkwin != tkwin))
180 {
181 /* in case of exo-screen conversions of non-pixels
182 * we force a recomputation from the string
183 */
184
185 FreePixelInternalRep(objPtr);
186 goto retry;
187 }
188 if ((pixelPtr->tkwin != tkwin)||dblPtr) {
171189 d = pixelPtr->value;
172190 if (pixelPtr->units >= 0) {
173191 d *= bias[pixelPtr->units] * WidthOfScreen(Tk_Screen(tkwin));
179197 pixelPtr->returnValue = (int) (d + 0.5);
180198 }
181199 pixelPtr->tkwin = tkwin;
200 if (dblPtr) {
201 *dblPtr=(double)d;
202 }
182203 }
183204 *intPtr = pixelPtr->returnValue;
184205 }
206 return TCL_OK;
207 }
208
209 /*
210 *----------------------------------------------------------------------
211 *
212 * Tk_GetPixelsFromObj --
213 *
214 * Attempt to return a pixel value from the Tcl object "objPtr". If the
215 * object is not already a pixel value, an attempt will be made to
216 * convert it to one.
217 *
218 * Results:
219 * The return value is a standard Tcl object result. If an error occurs
220 * during conversion, an error message is left in the interpreter's
221 * result unless "interp" is NULL.
222 *
223 * Side effects:
224 * If the object is not already a pixel, the conversion will free any old
225 * internal representation.
226 *
227 *----------------------------------------------------------------------
228 */
229
230 int
231 Tk_GetPixelsFromObj(
232 Tcl_Interp *interp, /* Used for error reporting if not NULL. */
233 Tk_Window tkwin,
234 Tcl_Obj *objPtr, /* The object from which to get pixels. */
235 int *intPtr) /* Place to store resulting pixels. */
236 {
237 return GetPixelsFromObjEx(interp,tkwin,objPtr,intPtr,NULL);
238 }
239
240 /*
241 *----------------------------------------------------------------------
242 *
243 * Tk_GetDoublePixelsFromObj --
244 *
245 * Attempt to return a double pixel value from the Tcl object
246 * "objPtr". If the object is not already a pixel value, an attempt will
247 * be made to convert it to one, the internal unit being pixels.
248 *
249 * Results:
250 * The return value is a standard Tcl object result. If an error occurs
251 * during conversion, an error message is left in the interpreter's
252 * result unless "interp" is NULL.
253 *
254 * Side effects:
255 * If the object is not already a pixel, the conversion will free any old
256 * internal representation.
257 *
258 *----------------------------------------------------------------------
259 */
260
261 int
262 Tk_GetDoublePixelsFromObj(
263 Tcl_Interp *interp, /* Used for error reporting if not NULL. */
264 Tk_Window tkwin,
265 Tcl_Obj *objPtr, /* The object from which to get pixels. */
266 double *doublePtr) /* Place to store resulting pixels. */
267 {
268 double d;
269 int result,val;
270
271 result=GetPixelsFromObjEx(interp, tkwin, objPtr, &val, &d);
272 if (result != TCL_OK) {
273 return result;
274 }
275 if (!SIMPLE_PIXELREP(objPtr)) {
276 PixelRep *pixelPtr;
277 pixelPtr = GET_COMPLEXPIXEL(objPtr);
278 if (pixelPtr->units >= 0) {
279 /* internally "shimmer" to pixel units */
280 pixelPtr->units=-1;
281 pixelPtr->value=d;
282 }
283 }
284 *doublePtr = d;
185285 return TCL_OK;
186286 }
187287
322422
323423 typePtr = objPtr->typePtr;
324424 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
325 (*typePtr->freeIntRepProc)(objPtr);
425 typePtr->freeIntRepProc(objPtr);
326426 }
327427
328428 objPtr->typePtr = &pixelObjType;
343443
344444 error:
345445 if (interp != NULL) {
346 /*
347 * Must copy string before resetting the result in case a caller is
348 * trying to convert the interpreter's result to pixels.
349 */
350
351 char buf[100];
352
353 sprintf(buf, "bad screen distance \"%.50s\"", string);
354 Tcl_ResetResult(interp);
355 Tcl_AppendResult(interp, buf, NULL);
446 Tcl_SetObjResult(interp, Tcl_ObjPrintf(
447 "bad screen distance \"%.50s\"", string));
356448 }
357449 return TCL_ERROR;
358450 }
399491 }
400492 }
401493
402 mmPtr = (MMRep *) objPtr->internalRep.otherValuePtr;
494 mmPtr = objPtr->internalRep.otherValuePtr;
403495 if (mmPtr->tkwin != tkwin) {
404496 d = mmPtr->value;
405497 if (mmPtr->units == -1) {
438530 FreeMMInternalRep(
439531 Tcl_Obj *objPtr) /* MM object with internal rep to free. */
440532 {
441 ckfree((char *) objPtr->internalRep.otherValuePtr);
533 ckfree(objPtr->internalRep.otherValuePtr);
442534 objPtr->internalRep.otherValuePtr = NULL;
443535 objPtr->typePtr = NULL;
444536 }
469561 MMRep *oldPtr, *newPtr;
470562
471563 copyPtr->typePtr = srcPtr->typePtr;
472 oldPtr = (MMRep *) srcPtr->internalRep.otherValuePtr;
564 oldPtr = srcPtr->internalRep.otherValuePtr;
473565 newPtr = (MMRep *) ckalloc(sizeof(MMRep));
474566 newPtr->value = oldPtr->value;
475567 newPtr->units = oldPtr->units;
476568 newPtr->tkwin = oldPtr->tkwin;
477569 newPtr->returnValue = oldPtr->returnValue;
478 copyPtr->internalRep.otherValuePtr = (void *) newPtr;
570 copyPtr->internalRep.otherValuePtr = newPtr;
479571 }
480572
481573 /*
505597 char buffer[TCL_DOUBLE_SPACE];
506598 register int len;
507599
508 mmPtr = (MMRep *) objPtr->internalRep.otherValuePtr;
600 mmPtr = objPtr->internalRep.otherValuePtr;
509601 /* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */
510602 if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) {
511603 Tcl_Panic("UpdateStringOfMM: false precondition");
559651 */
560652
561653 tclDoubleObjType = Tcl_GetObjType("double");
562 tclIntObjType = Tcl_GetObjType("int");
654 tclIntObjType = Tcl_GetObjType("int");
563655 }
564656
565657 if (objPtr->typePtr == tclDoubleObjType) {
627719
628720 typePtr = objPtr->typePtr;
629721 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
630 (*typePtr->freeIntRepProc)(objPtr);
631 }
632
633 objPtr->typePtr = &mmObjType;
634
635 mmPtr = (MMRep *) ckalloc(sizeof(MMRep));
636 mmPtr->value = d;
637 mmPtr->units = units;
638 mmPtr->tkwin = NULL;
722 typePtr->freeIntRepProc(objPtr);
723 }
724
725 objPtr->typePtr = &mmObjType;
726
727 mmPtr = (MMRep *) ckalloc(sizeof(MMRep));
728 mmPtr->value = d;
729 mmPtr->units = units;
730 mmPtr->tkwin = NULL;
639731 mmPtr->returnValue = d;
640732
641 objPtr->internalRep.otherValuePtr = (void *) mmPtr;
733 objPtr->internalRep.otherValuePtr = mmPtr;
642734
643735 return TCL_OK;
644736 }
671763 Tcl_Obj *objPtr, /* The object from which to get window. */
672764 Tk_Window *windowPtr) /* Place to store resulting window. */
673765 {
674 TkMainInfo *mainPtr = ((TkWindow *)tkwin)->mainPtr;
766 TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr;
675767 register WindowRep *winPtr;
676768 int result;
677769
680772 return result;
681773 }
682774
683 winPtr = (WindowRep *) objPtr->internalRep.otherValuePtr;
684 if ( winPtr->tkwin == NULL
685 || winPtr->mainPtr == NULL
686 || winPtr->mainPtr != mainPtr
687 || winPtr->epoch != mainPtr->deletionEpoch)
688 {
689 /* Cache is invalid.
775 winPtr = objPtr->internalRep.otherValuePtr;
776 if (winPtr->tkwin == NULL
777 || winPtr->mainPtr == NULL
778 || winPtr->mainPtr != mainPtr
779 || winPtr->epoch != mainPtr->deletionEpoch) {
780 /*
781 * Cache is invalid.
690782 */
783
691784 winPtr->tkwin = Tk_NameToWindow(interp,
692785 Tcl_GetStringFromObj(objPtr, NULL), tkwin);
786 if (winPtr->tkwin == NULL) {
787 /* ASSERT: Tk_NameToWindow has left error message in interp */
788 return TCL_ERROR;
789 }
790
693791 winPtr->mainPtr = mainPtr;
694792 winPtr->epoch = mainPtr ? mainPtr->deletionEpoch : 0;
695793 }
696794
697795 *windowPtr = winPtr->tkwin;
698
699 if (winPtr->tkwin == NULL) {
700 /* ASSERT: Tk_NameToWindow has left error message in interp */
701 return TCL_ERROR;
702 }
703796 return TCL_OK;
704797 }
705798
738831 Tcl_GetStringFromObj(objPtr, NULL);
739832 typePtr = objPtr->typePtr;
740833 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
741 (*typePtr->freeIntRepProc)(objPtr);
834 typePtr->freeIntRepProc(objPtr);
742835 }
743836
744837 winPtr = (WindowRep *) ckalloc(sizeof(WindowRep));
746839 winPtr->mainPtr = NULL;
747840 winPtr->epoch = 0;
748841
749 objPtr->internalRep.otherValuePtr = (void *) winPtr;
842 objPtr->internalRep.otherValuePtr = winPtr;
750843 objPtr->typePtr = &windowObjType;
751844
752845 return TCL_OK;
782875 newPtr->tkwin = oldPtr->tkwin;
783876 newPtr->mainPtr = oldPtr->mainPtr;
784877 newPtr->epoch = oldPtr->epoch;
785 copyPtr->internalRep.otherValuePtr = (void *) newPtr;
878 copyPtr->internalRep.otherValuePtr = newPtr;
786879 copyPtr->typePtr = srcPtr->typePtr;
787880 }
788881
808901 FreeWindowInternalRep(
809902 Tcl_Obj *objPtr) /* Window object with internal rep to free. */
810903 {
811 ckfree((char *) objPtr->internalRep.otherValuePtr);
904 ckfree(objPtr->internalRep.otherValuePtr);
812905 objPtr->internalRep.otherValuePtr = NULL;
813906 objPtr->typePtr = NULL;
814907 }
815908
816909 /*
817 *--------------------------------------------------------------
910 *----------------------------------------------------------------------
911 *
912 * TkNewWindowObj --
913 *
914 * This function allocates a new Tcl_Obj that refers to a particular to a
915 * particular Tk window.
916 *
917 * Results:
918 * A standard Tcl object reference, with refcount 0.
919 *
920 * Side effects:
921 * None.
922 *
923 *----------------------------------------------------------------------
924 */
925
926 Tcl_Obj *
927 TkNewWindowObj(
928 Tk_Window tkwin)
929 {
930 Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
931 TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr;
932 register WindowRep *winPtr;
933
934 SetWindowFromAny(NULL, objPtr);
935
936 winPtr = objPtr->internalRep.otherValuePtr;
937 winPtr->tkwin = tkwin;
938 winPtr->mainPtr = mainPtr;
939 winPtr->epoch = mainPtr->deletionEpoch;
940 return objPtr;
941 }
942
943 /*
944 *----------------------------------------------------------------------
818945 *
819946 * TkParsePadAmount --
820947 *
832959 * An error message is written to the interpreter if something is not
833960 * right.
834961 *
835 *--------------------------------------------------------------
962 *----------------------------------------------------------------------
836963 */
837964
838965 int
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkOldConfig.c,v 1.24 2008/04/27 22:38:56 dkf Exp $
13 * RCS: @(#) $Id: tkOldConfig.c,v 1.28 2008/11/27 23:26:05 nijtmans Exp $
1414 */
1515
1616 #include "tkPort.h"
542542 break;
543543 }
544544 case TK_CONFIG_CUSTOM:
545 if ((*specPtr->customPtr->parseProc)(
546 specPtr->customPtr->clientData, interp, tkwin, value,
547 widgRec, specPtr->offset) != TCL_OK) {
545 if (specPtr->customPtr->parseProc(specPtr->customPtr->clientData,
546 interp, tkwin, value, widgRec, specPtr->offset)!=TCL_OK) {
548547 return TCL_ERROR;
549548 }
550549 break;
606605 register Tk_ConfigSpec *specPtr;
607606 int needFlags, hateFlags;
608607 char *list;
609 char *leader = "{";
608 const char *leader = "{";
610609
611610 needFlags = flags & ~(TK_CONFIG_USER_BIT - 1);
612611 if (Tk_Depth(tkwin) <= 1) {
626625 * handle that one spec specially.
627626 */
628627
629 Tcl_SetResult(interp, NULL, TCL_STATIC);
628 Tcl_ResetResult(interp);
630629 if (argvName != NULL) {
631630 specPtr = FindConfigSpec(interp, specs, argvName, needFlags,hateFlags);
632631 if (specPtr == NULL) {
633632 return TCL_ERROR;
634633 }
635 Tcl_SetResult(interp,
636 FormatConfigInfo(interp, tkwin, specPtr, widgRec),
637 TCL_DYNAMIC);
634 list = FormatConfigInfo(interp, tkwin, specPtr, widgRec);
635 Tcl_SetResult(interp, list, TCL_VOLATILE);
636 ckfree(list);
638637 return TCL_OK;
639638 }
640639
722721 if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
723722 ckfree((char *) argv[4]);
724723 } else {
725 (*freeProc)((char *) argv[4]);
724 freeProc((char *) argv[4]);
726725 }
727726 }
728727 return result;
871870 break;
872871 }
873872 case TK_CONFIG_CUSTOM:
874 result = (*specPtr->customPtr->printProc)(
875 specPtr->customPtr->clientData, tkwin, widgRec,
876 specPtr->offset, freeProcPtr);
873 result = specPtr->customPtr->printProc(specPtr->customPtr->clientData,
874 tkwin, widgRec, specPtr->offset, freeProcPtr);
877875 break;
878876 default:
879877 result = "?? unknown type ??";
944942 if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
945943 ckfree((char *) result);
946944 } else {
947 (*freeProc)((char *) result);
945 freeProc((char *) result);
948946 }
949947 }
950948 return TCL_OK;
1313 * See the file "license.terms" for information on usage and redistribution of
1414 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1515 *
16 * RCS: @(#) $Id: tkOldTest.c,v 1.3 2008/07/23 23:24:21 nijtmans Exp $
16 * RCS: @(#) $Id: tkOldTest.c,v 1.4 2008/11/03 22:20:22 nijtmans Exp $
1717 */
1818
1919 #define USE_OLD_IMAGE
143143 * will be returned in later callbacks. */
144144 {
145145 TImageMaster *timPtr;
146 char *varName;
146 const char *varName;
147147 int i;
148148
149149 varName = "log";
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkOption.c,v 1.26 2008/08/21 09:43:53 dkf Exp $
13 * RCS: @(#) $Id: tkOption.c,v 1.28 2008/10/30 23:18:59 nijtmans Exp $
1414 */
1515
1616 #include "tkInt.h"
224224 static void OptionInit(TkMainInfo *mainPtr);
225225 static int ParsePriority(Tcl_Interp *interp, char *string);
226226 static int ReadOptionFile(Tcl_Interp *interp, Tk_Window tkwin,
227 char *fileName, int priority);
227 const char *fileName, int priority);
228228 static void SetupStacks(TkWindow *winPtr, int leaf);
229229
230230 /*
620620 ThreadSpecificData *tsdPtr =
621621 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
622622
623 static const char *optionCmds[] = {
623 static const char *const optionCmds[] = {
624624 "add", "clear", "get", "readfile", NULL
625625 };
626626
10661066 Tcl_Interp *interp, /* Interpreter to use for reporting results. */
10671067 Tk_Window tkwin, /* Token for window: options are entered for
10681068 * this window's main window. */
1069 char *fileName, /* Name of file containing options. */
1069 const char *fileName, /* Name of file containing options. */
10701070 int priority) /* Priority level to use for options in this
10711071 * file, such as TK_USER_DEFAULT_PRIO or
10721072 * TK_INTERACTIVE_PRIO. Must be between 0 and
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkPack.c,v 1.28 2008/04/27 22:38:56 dkf Exp $
12 * RCS: @(#) $Id: tkPack.c,v 1.32 2008/12/07 16:35:44 das Exp $
1313 */
1414
1515 #include "tkInt.h"
1616
1717 typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side;
18 static const char *sideNames[] = {
18 static const char *const sideNames[] = {
1919 "top", "bottom", "left", "right", NULL
2020 };
2121
150150 TkPrintPadAmount(
151151 Tcl_Interp *interp, /* The interpreter into which the result is
152152 * written. */
153 char *switchName, /* One of "padx", "pady", "ipadx" or "ipady" */
153 const char *switchName, /* One of "padx", "pady", "ipadx" or "ipady" */
154154 int halfSpace, /* The left or top padding amount */
155155 int allSpace) /* The total amount of padding */
156156 {
190190 {
191191 Tk_Window tkwin = clientData;
192192 char *argv2;
193 static const char *optionStrings[] = {
193 static const char *const optionStrings[] = {
194194 /* after, append, before and unpack are deprecated */
195195 "after", "append", "before", "unpack",
196196 "configure", "forget", "info", "propagate", "slaves", NULL };
406406 case PACK_SLAVES: {
407407 Tk_Window master;
408408 Packer *masterPtr, *slavePtr;
409 Tcl_Obj *resultObj;
409410
410411 if (objc != 3) {
411412 Tcl_WrongNumArgs(interp, 2, objv, "window");
414415 if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
415416 return TCL_ERROR;
416417 }
418 resultObj = Tcl_NewObj();
417419 masterPtr = GetPacker(master);
418420 for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
419421 slavePtr = slavePtr->nextPtr) {
420 Tcl_AppendElement(interp, Tk_PathName(slavePtr->tkwin));
421 }
422 Tcl_ListObjAppendElement(NULL, resultObj,
423 TkNewWindowObj(slavePtr->tkwin));
424 }
425 Tcl_SetObjResult(interp, resultObj);
422426 break;
423427 }
424428 case PACK_UNPACK: {
888892 childWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
889893 + slavePtr->padX + slavePtr->iPadX;
890894 if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
891 curExpand = (cavityWidth - childWidth)/numExpand;
892 if (curExpand < minExpand) {
893 minExpand = curExpand;
895 if (numExpand) {
896 curExpand = (cavityWidth - childWidth)/numExpand;
897 if (curExpand < minExpand) {
898 minExpand = curExpand;
899 }
894900 }
895901 } else {
896902 cavityWidth -= childWidth;
899905 }
900906 }
901907 }
902 curExpand = cavityWidth/numExpand;
903 if (curExpand < minExpand) {
904 minExpand = curExpand;
908 if (numExpand) {
909 curExpand = cavityWidth/numExpand;
910 if (curExpand < minExpand) {
911 minExpand = curExpand;
912 }
905913 }
906914 return (minExpand < 0) ? 0 : minExpand;
907915 }
943951 childHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
944952 + slavePtr->padY + slavePtr->iPadY;
945953 if ((slavePtr->side == LEFT) || (slavePtr->side == RIGHT)) {
946 curExpand = (cavityHeight - childHeight)/numExpand;
947 if (curExpand < minExpand) {
948 minExpand = curExpand;
954 if (numExpand) {
955 curExpand = (cavityHeight - childHeight)/numExpand;
956 if (curExpand < minExpand) {
957 minExpand = curExpand;
958 }
949959 }
950960 } else {
951961 cavityHeight -= childHeight;
954964 }
955965 }
956966 }
957 curExpand = cavityHeight/numExpand;
958 if (curExpand < minExpand) {
959 minExpand = curExpand;
967 if (numExpand) {
968 curExpand = cavityHeight/numExpand;
969 if (curExpand < minExpand) {
970 minExpand = curExpand;
971 }
960972 }
961973 return (minExpand < 0) ? 0 : minExpand;
962974 }
14471459 Tk_Window other, slave, parent, ancestor;
14481460 int i, j, numWindows, tmp, positionGiven;
14491461 char *string;
1450 static const char *optionStrings[] = {
1462 static const char *const optionStrings[] = {
14511463 "-after", "-anchor", "-before", "-expand", "-fill",
14521464 "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", NULL };
14531465 enum options {
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkPanedWindow.c,v 1.34 2008/10/05 18:22:21 dkf Exp $
14 * RCS: @(#) $Id: tkPanedWindow.c,v 1.37 2008/11/08 22:52:29 dkf Exp $
1515 */
1616
1717 #include "default.h"
3636 * The following table defines the legal values for the -orient option.
3737 */
3838
39 static char *orientStrings[] = {
39 static const char *const orientStrings[] = {
4040 "horizontal", "vertical", NULL
4141 };
4242
4646 * The following table defines the legal values for the -stretch option.
4747 */
4848
49 static char *stretchStrings[] = {
49 static const char *const stretchStrings[] = {
5050 "always", "first", "last", "middle", "never", NULL
5151 };
5252
492492 return TCL_ERROR;
493493 }
494494
495 Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pwPtr->tkwin), -1));
495 Tcl_SetObjResult(interp, TkNewWindowObj(pwPtr->tkwin));
496496 return TCL_OK;
497497 }
498498
523523 {
524524 PanedWindow *pwPtr = clientData;
525525 int result = TCL_OK;
526 static const char *optionStrings[] = {
526 static const char *const optionStrings[] = {
527527 "add", "cget", "configure", "forget", "identify", "panecget",
528528 "paneconfigure", "panes", "proxy", "sash", NULL
529529 };
10671067 int objc, /* Number of arguments. */
10681068 Tcl_Obj *const objv[]) /* Argument objects. */
10691069 {
1070 static const char *sashOptionStrings[] = {
1070 static const char *const sashOptionStrings[] = {
10711071 "coord", "dragto", "mark", "place", NULL
10721072 };
10731073 enum sashOptions {
27582758 int objc, /* Number of arguments. */
27592759 Tcl_Obj *const objv[]) /* Argument objects. */
27602760 {
2761 static const char *optionStrings[] = {
2761 static const char *const optionStrings[] = {
27622762 "coord", "forget", "place", NULL
27632763 };
27642764 enum options {
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkPlace.c,v 1.25 2008/04/27 22:38:56 dkf Exp $
12 * RCS: @(#) $Id: tkPlace.c,v 1.28 2008/11/08 22:52:29 dkf Exp $
1313 */
1414
1515 #include "tkInt.h"
2525 * actual window size.
2626 */
2727
28 static char *borderModeStrings[] = {
28 static const char *const borderModeStrings[] = {
2929 "inside", "outside", "ignore", NULL
3030 };
3131
211211 {
212212 Tk_Window tkwin;
213213 Slave *slavePtr;
214 char *string;
215214 TkDisplay *dispPtr;
216215 Tk_OptionTable optionTable;
217 static const char *optionStrings[] = {
216 static const char *const optionStrings[] = {
218217 "configure", "forget", "info", "slaves", NULL
219218 };
220219 enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
236235 * Handle special shortcut where window name is first argument.
237236 */
238237
239 string = Tcl_GetString(objv[1]);
240 if (string[0] == '.') {
241 tkwin = Tk_NameToWindow(interp, string, Tk_MainWindow(interp));
242 if (tkwin == NULL) {
238 if (Tcl_GetString(objv[1])[0] == '.') {
239 if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), objv[1],
240 &tkwin) != TCL_OK) {
243241 return TCL_ERROR;
244242 }
245243
262260 * possible additional arguments.
263261 */
264262
265 tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
266 Tk_MainWindow(interp));
267 if (tkwin == NULL) {
263 if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), objv[2],
264 &tkwin) != TCL_OK) {
268265 return TCL_ERROR;
269266 }
270267
347344 for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
348345 slavePtr = slavePtr->nextPtr) {
349346 Tcl_ListObjAppendElement(interp, listPtr,
350 Tcl_NewStringObj(Tk_PathName(slavePtr->tkwin),-1));
347 TkNewWindowObj(slavePtr->tkwin));
351348 }
352349 Tcl_SetObjResult(interp, listPtr);
353350 }
404401 slavePtr->optionTable = table;
405402 Tcl_SetHashValue(hPtr, slavePtr);
406403 Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
407 (ClientData) slavePtr);
404 slavePtr);
408405 return slavePtr;
409406 }
410407
508505 }
509506 }
510507 }
511
508
512509 if (masterPtr->abortPtr != NULL) {
513510 *masterPtr->abortPtr = 1;
514511 }
860857 * placement operation. */
861858
862859 masterPtr->flags &= ~PARENT_RECONFIG_PENDING;
863
860
864861 /*
865862 * Abort any nested call to RecomputePlacement for this window, since
866 * we'll do everything necessary here, and set up so this call
867 * can be aborted if necessary.
863 * we'll do everything necessary here, and set up so this call can be
864 * aborted if necessary.
868865 */
869866
870867 if (masterPtr->abortPtr != NULL) {
10761073 register Slave *slavePtr, *nextPtr;
10771074 TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr;
10781075
1079 if (eventPtr->type == ConfigureNotify) {
1076 switch (eventPtr->type) {
1077 case ConfigureNotify:
10801078 if ((masterPtr->slavePtr != NULL)
10811079 && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
10821080 masterPtr->flags |= PARENT_RECONFIG_PENDING;
10831081 Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
10841082 }
1085 } else if (eventPtr->type == DestroyNotify) {
1083 return;
1084 case DestroyNotify:
10861085 for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
10871086 slavePtr = nextPtr) {
10881087 slavePtr->masterPtr = NULL;
10991098 *masterPtr->abortPtr = 1;
11001099 }
11011100 Tcl_EventuallyFree(masterPtr, TCL_DYNAMIC);
1102 } else if (eventPtr->type == MapNotify) {
1101 return;
1102 case MapNotify:
11031103 /*
11041104 * When a master gets mapped, must redo the geometry computation so
11051105 * that all of its slaves get remapped.
11101110 masterPtr->flags |= PARENT_RECONFIG_PENDING;
11111111 Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
11121112 }
1113 } else if (eventPtr->type == UnmapNotify) {
1113 return;
1114 case UnmapNotify:
11141115 /*
11151116 * Unmap all of the slaves when the master gets unmapped, so that they
11161117 * don't keep redisplaying themselves.
11201121 slavePtr = slavePtr->nextPtr) {
11211122 Tk_UnmapWindow(slavePtr->tkwin);
11221123 }
1124 return;
11231125 }
11241126 }
11251127
77 * See the file "license.terms" for information on usage and redistribution
88 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkPlatDecls.h,v 1.18 2008/04/08 03:28:05 kennykb Exp $
10 * RCS: @(#) $Id: tkPlatDecls.h,v 1.19 2008/10/22 20:56:43 nijtmans Exp $
1111 */
1212
1313 #ifndef _TKPLATDECLS
5959 #ifndef Tk_TranslateWinEvent_TCL_DECLARED
6060 #define Tk_TranslateWinEvent_TCL_DECLARED
6161 /* 5 */
62 EXTERN int Tk_TranslateWinEvent (HWND hwnd, UINT message,
63 WPARAM wParam, LPARAM lParam,
62 EXTERN int Tk_TranslateWinEvent (HWND hwnd, UINT message,
63 WPARAM wParam, LPARAM lParam,
6464 LRESULT * result);
6565 #endif
6666 #endif /* WIN */
6969 #define Tk_MacOSXSetEmbedHandler_TCL_DECLARED
7070 /* 0 */
7171 EXTERN void Tk_MacOSXSetEmbedHandler (
72 Tk_MacOSXEmbedRegisterWinProc * registerWinProcPtr,
73 Tk_MacOSXEmbedGetGrafPortProc * getPortProcPtr,
74 Tk_MacOSXEmbedMakeContainerExistProc * containerExistProcPtr,
75 Tk_MacOSXEmbedGetClipProc * getClipProc,
72 Tk_MacOSXEmbedRegisterWinProc * registerWinProcPtr,
73 Tk_MacOSXEmbedGetGrafPortProc * getPortProcPtr,
74 Tk_MacOSXEmbedMakeContainerExistProc * containerExistProcPtr,
75 Tk_MacOSXEmbedGetClipProc * getClipProc,
7676 Tk_MacOSXEmbedGetOffsetInParentProc * getOffsetProc);
7777 #endif
7878 #ifndef Tk_MacOSXTurnOffMenus_TCL_DECLARED
9898 #ifndef TkGenWMConfigureEvent_TCL_DECLARED
9999 #define TkGenWMConfigureEvent_TCL_DECLARED
100100 /* 5 */
101 EXTERN void TkGenWMConfigureEvent (Tk_Window tkwin, int x, int y,
101 EXTERN void TkGenWMConfigureEvent (Tk_Window tkwin, int x, int y,
102102 int width, int height, int flags);
103103 #endif
104104 #ifndef TkMacOSXInvalClipRgns_TCL_DECLARED
130130
131131 typedef struct TkPlatStubs {
132132 int magic;
133 CONST struct TkPlatStubHooks *hooks;
133 const struct TkPlatStubHooks *hooks;
134134
135135 #ifdef __WIN32__ /* WIN */
136136 Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */
156156 } TkPlatStubs;
157157
158158 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
159 extern CONST TkPlatStubs *tkPlatStubsPtr;
159 extern const TkPlatStubs *tkPlatStubsPtr;
160160 #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
161161
162162 #if defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS)
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkRectOval.c,v 1.18 2008/04/27 22:38:57 dkf Exp $
11 * RCS: @(#) $Id: tkRectOval.c,v 1.19 2008/11/09 20:51:28 nijtmans Exp $
1212 */
1313
1414 #include <stdio.h>
4444 * Information used for parsing configuration specs:
4545 */
4646
47 static Tk_CustomOption stateOption = {
48 (Tk_OptionParseProc *) TkStateParseProc,
49 TkStatePrintProc, (ClientData) 2
47 static const Tk_CustomOption stateOption = {
48 TkStateParseProc, TkStatePrintProc, (ClientData) 2
5049 };
51 static Tk_CustomOption tagsOption = {
52 (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
53 Tk_CanvasTagsPrintProc, (ClientData) NULL
50 static const Tk_CustomOption tagsOption = {
51 Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
5452 };
55 static Tk_CustomOption dashOption = {
56 (Tk_OptionParseProc *) TkCanvasDashParseProc,
57 TkCanvasDashPrintProc, (ClientData) NULL
53 static const Tk_CustomOption dashOption = {
54 TkCanvasDashParseProc, TkCanvasDashPrintProc, (ClientData) NULL
5855 };
59 static Tk_CustomOption offsetOption = {
60 (Tk_OptionParseProc *) TkOffsetParseProc,
61 TkOffsetPrintProc, (ClientData) TK_OFFSET_RELATIVE
56 static const Tk_CustomOption offsetOption = {
57 TkOffsetParseProc, TkOffsetPrintProc, (ClientData) TK_OFFSET_RELATIVE
6258 };
63 static Tk_CustomOption pixelOption = {
64 (Tk_OptionParseProc *) TkPixelParseProc,
65 TkPixelPrintProc, (ClientData) NULL
59 static const Tk_CustomOption pixelOption = {
60 TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL
6661 };
6762
6863 static Tk_ConfigSpec configSpecs[] = {
1515 * See the file "license.terms" for information on usage and redistribution of
1616 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1717 *
18 * RCS: @(#) $Id: tkScale.c,v 1.30 2008/07/23 23:24:23 nijtmans Exp $
18 * RCS: @(#) $Id: tkScale.c,v 1.33 2008/11/08 22:52:29 dkf Exp $
1919 */
2020
2121 #include "default.h"
2727 * used together with the "enum orient" declaration in tkScale.h.
2828 */
2929
30 static char *orientStrings[] = {
30 static const char *const orientStrings[] = {
3131 "horizontal", "vertical", NULL
3232 };
3333
3636 * used together with the "enum state" declaration in tkScale.h.
3737 */
3838
39 static char *stateStrings[] = {
39 static const char *const stateStrings[] = {
4040 "active", "disabled", "normal", NULL
4141 };
4242
141141 * scale widget command.
142142 */
143143
144 static const char *commandNames[] = {
144 static const char *const commandNames[] = {
145145 "cget", "configure", "coords", "get", "identify", "set", NULL
146146 };
147147
302302 return TCL_ERROR;
303303 }
304304
305 Tcl_SetResult(interp, Tk_PathName(scalePtr->tkwin), TCL_STATIC);
305 Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin));
306306 return TCL_OK;
307307 }
308308
356356 scalePtr->optionTable, objv[2], scalePtr->tkwin);
357357 if (objPtr == NULL) {
358358 goto error;
359 } else {
360 Tcl_SetObjResult(interp, objPtr);
361 }
359 }
360 Tcl_SetObjResult(interp, objPtr);
362361 break;
363362 case COMMAND_CONFIGURE:
364363 if (objc <= 3) {
367366 (objc == 3) ? objv[2] : NULL, scalePtr->tkwin);
368367 if (objPtr == NULL) {
369368 goto error;
370 } else {
371 Tcl_SetObjResult(interp, objPtr);
372369 }
370 Tcl_SetObjResult(interp, objPtr);
373371 } else {
374372 result = ConfigureScale(interp, scalePtr, objc-2, objv+2);
375373 }
376374 break;
377375 case COMMAND_COORDS: {
378 int x, y ;
376 int x, y;
379377 double value;
380 char buf[TCL_INTEGER_SPACE * 2];
381378
382379 if ((objc != 2) && (objc != 3)) {
383380 Tcl_WrongNumArgs(interp, 1, objv, "coords ?value?");
399396 y = scalePtr->horizTroughY + scalePtr->width/2
400397 + scalePtr->borderWidth;
401398 }
402 sprintf(buf, "%d %d", x, y);
403 Tcl_SetResult(interp, buf, TCL_VOLATILE);
399 Tcl_SetObjResult(interp, Tcl_ObjPrintf("%d %d", x, y));
404400 break;
405401 }
406402 case COMMAND_GET: {
407403 double value;
408404 int x, y;
409 char buf[TCL_DOUBLE_SPACE];
410405
411406 if ((objc != 2) && (objc != 4)) {
412407 Tcl_WrongNumArgs(interp, 1, objv, "get ?x y?");
421416 }
422417 value = TkScalePixelToValue(scalePtr, x, y);
423418 }
424 sprintf(buf, scalePtr->format, value);
425 Tcl_SetResult(interp, buf, TCL_VOLATILE);
419 Tcl_SetObjResult(interp, Tcl_ObjPrintf(scalePtr->format, value));
426420 break;
427421 }
428422 case COMMAND_IDENTIFY: {
11751169 int flags) /* Information about what happened. */
11761170 {
11771171 register TkScale *scalePtr = clientData;
1178 char *resultStr;
1172 const char *resultStr;
11791173 double value;
11801174 Tcl_Obj *valuePtr;
11811175 int result;
12261220 }
12271221 TkEventuallyRedrawScale(scalePtr, REDRAW_SLIDER);
12281222
1229 return resultStr;
1223 return (char *) resultStr;
12301224 }
12311225
12321226 /*
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkScrollbar.c,v 1.15 2008/10/03 13:13:31 dkf Exp $
13 * RCS: @(#) $Id: tkScrollbar.c,v 1.17 2008/11/09 20:51:28 nijtmans Exp $
1414 */
1515
1616 #include "tkInt.h"
2121 * Custom option for handling "-orient"
2222 */
2323
24 static Tk_CustomOption orientOption = {
25 (Tk_OptionParseProc *) TkOrientParseProc,
26 TkOrientPrintProc,
27 NULL
24 static const Tk_CustomOption orientOption = {
25 TkOrientParseProc, TkOrientPrintProc, (ClientData) NULL
2826 };
2927
3028 /*
195193 return TCL_ERROR;
196194 }
197195
198 Tcl_SetResult(interp, Tk_PathName(scrollPtr->tkwin), TCL_STATIC);
196 Tcl_SetObjResult(interp, TkNewWindowObj(scrollPtr->tkwin));
199197 return TCL_OK;
200198 }
201199
298296 } else if ((c == 'd') && (strncmp(argv[1], "delta", length) == 0)) {
299297 int xDelta, yDelta, pixels, length;
300298 double fraction;
301 char buf[TCL_DOUBLE_SPACE];
302299
303300 if (argc != 4) {
304301 Tcl_AppendResult(interp, "wrong # args: should be \"",
323320 } else {
324321 fraction = ((double) pixels / (double) length);
325322 }
326 Tcl_PrintDouble(NULL, fraction, buf);
327 Tcl_SetResult(interp, buf, TCL_VOLATILE);
323 Tcl_SetObjResult(interp, Tcl_NewDoubleObj(fraction));
328324 } else if ((c == 'f') && (strncmp(argv[1], "fraction", length) == 0)) {
329325 int x, y, pos, length;
330326 double fraction;
331 char buf[TCL_DOUBLE_SPACE];
332327
333328 if (argc != 4) {
334329 Tcl_AppendResult(interp, "wrong # args: should be \"",
358353 } else if (fraction > 1.0) {
359354 fraction = 1.0;
360355 }
361 Tcl_PrintDouble(NULL, fraction, buf);
362 Tcl_SetResult(interp, buf, TCL_VOLATILE);
356 Tcl_SetObjResult(interp, Tcl_NewDoubleObj(fraction));
363357 } else if ((c == 'g') && (strncmp(argv[1], "get", length) == 0)) {
364358 if (argc != 2) {
365359 Tcl_AppendResult(interp, "wrong # args: should be \"",
367361 goto error;
368362 }
369363 if (scrollPtr->flags & NEW_STYLE_COMMANDS) {
370 char first[TCL_DOUBLE_SPACE], last[TCL_DOUBLE_SPACE];
371
372 Tcl_PrintDouble(NULL, scrollPtr->firstFraction, first);
373 Tcl_PrintDouble(NULL, scrollPtr->lastFraction, last);
374 Tcl_AppendResult(interp, first, " ", last, NULL);
364 Tcl_Obj *resObjs[2];
365
366 resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction);
367 resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction);
368 Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs));
375369 } else {
376 char buf[TCL_INTEGER_SPACE * 4];
377
378 sprintf(buf, "%d %d %d %d", scrollPtr->totalUnits,
379 scrollPtr->windowUnits, scrollPtr->firstUnit,
380 scrollPtr->lastUnit);
381 Tcl_SetResult(interp, buf, TCL_VOLATILE);
370 Tcl_Obj *resObjs[4];
371
372 resObjs[0] = Tcl_NewIntObj(scrollPtr->totalUnits);
373 resObjs[1] = Tcl_NewIntObj(scrollPtr->windowUnits);
374 resObjs[2] = Tcl_NewIntObj(scrollPtr->firstUnit);
375 resObjs[3] = Tcl_NewIntObj(scrollPtr->lastUnit);
376 Tcl_SetObjResult(interp, Tcl_NewListObj(4, resObjs));
382377 }
383378 } else if ((c == 'i') && (strncmp(argv[1], "identify", length) == 0)) {
384379 int x, y, thing;
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkSelect.c,v 1.23 2008/10/05 18:22:21 dkf Exp $
12 * RCS: @(#) $Id: tkSelect.c,v 1.27 2008/12/09 21:22:56 dgp Exp $
1313 */
1414
1515 #include "tkInt.h"
6666 int offset, char *buffer, int maxBytes);
6767 static void LostSelection(ClientData clientData);
6868 static int SelGetProc(ClientData clientData,
69 Tcl_Interp *interp, char *portion);
69 Tcl_Interp *interp, const char *portion);
7070
7171 /*
7272 *--------------------------------------------------------------
434434 */
435435
436436 if (clearProc != NULL) {
437 (*clearProc)(clearData);
437 clearProc(clearData);
438438 }
439439 }
440440
498498 XSetSelectionOwner(winPtr->display, selection, None, CurrentTime);
499499
500500 if (clearProc != NULL) {
501 (*clearProc)(clearData);
501 clearProc(clearData);
502502 }
503503 }
504504
603603 goto cantget;
604604 }
605605 buffer[count] = 0;
606 result = (*proc)(clientData, interp, buffer);
606 result = proc(clientData, interp, buffer);
607607 } else {
608608 offset = 0;
609609 result = TCL_OK;
611611 ip.nextPtr = tsdPtr->pendingPtr;
612612 tsdPtr->pendingPtr = &ip;
613613 while (1) {
614 count = (selPtr->proc)(selPtr->clientData, offset, buffer,
614 count = selPtr->proc(selPtr->clientData, offset, buffer,
615615 TK_SEL_BYTES_AT_ONCE);
616616 if ((count < 0) || (ip.selPtr == NULL)) {
617617 tsdPtr->pendingPtr = ip.nextPtr;
621621 Tcl_Panic("selection handler returned too many bytes");
622622 }
623623 buffer[count] = '\0';
624 result = (*proc)(clientData, interp, buffer);
624 result = proc(clientData, interp, buffer);
625625 if ((result != TCL_OK) || (count < TK_SEL_BYTES_AT_ONCE)
626626 || (ip.selPtr == NULL)) {
627627 break;
678678 char *selName = NULL, *string;
679679 int count, index;
680680 Tcl_Obj **objs;
681 static const char *optionStrings[] = {
681 static const char *const optionStrings[] = {
682682 "clear", "get", "handle", "own", NULL
683683 };
684684 enum options {
697697
698698 switch ((enum options) index) {
699699 case SELECTION_CLEAR: {
700 static const char *clearOptionStrings[] = {
700 static const char *const clearOptionStrings[] = {
701701 "-displayof", "-selection", NULL
702702 };
703703 enum clearOptions { CLEAR_DISPLAYOF, CLEAR_SELECTION };
756756 char *targetName = NULL;
757757 Tcl_DString selBytes;
758758 int result;
759 static const char *getOptionStrings[] = {
759 static const char *const getOptionStrings[] = {
760760 "-displayof", "-selection", "-type", NULL
761761 };
762762 enum getOptions { GET_DISPLAYOF, GET_SELECTION, GET_TYPE };
831831 char *formatName = NULL;
832832 register CommandInfo *cmdInfoPtr;
833833 int cmdLength;
834 static const char *handleOptionStrings[] = {
834 static const char *const handleOptionStrings[] = {
835835 "-format", "-selection", "-type", NULL
836836 };
837837 enum handleOptions {
919919 register LostCommand *lostPtr;
920920 char *script = NULL;
921921 int cmdLength;
922 static const char *ownOptionStrings[] = {
922 static const char *const ownOptionStrings[] = {
923923 "-command", "-displayof", "-selection", NULL
924924 };
925925 enum ownOptions { OWN_COMMAND, OWN_DISPLAYOF, OWN_SELECTION };
12581258 */
12591259
12601260 if (infoPtr->clearProc != NULL) {
1261 (*infoPtr->clearProc)(infoPtr->clearData);
1261 infoPtr->clearProc(infoPtr->clearData);
12621262 }
12631263 ckfree((char *) infoPtr);
12641264 }
12891289 * selection. */
12901290 Tcl_Interp *interp, /* Interpreter used for error reporting (not
12911291 * used). */
1292 char *portion) /* New information to be appended. */
1292 const char *portion) /* New information to be appended. */
12931293 {
12941294 Tcl_DStringAppend(clientData, portion, -1);
12951295 return TCL_OK;
15591559 LostCommand *lostPtr = clientData;
15601560 Tcl_Obj *objPtr;
15611561 Tcl_Interp *interp;
1562 int code;
15621563
15631564 interp = lostPtr->interp;
15641565 Tcl_Preserve(interp);
15721573 Tcl_IncrRefCount(objPtr);
15731574 Tcl_ResetResult(interp);
15741575
1575 if (TkCopyAndGlobalEval(interp, lostPtr->command) != TCL_OK) {
1576 Tcl_BackgroundError(interp);
1576 code = TkCopyAndGlobalEval(interp, lostPtr->command);
1577 if (code != TCL_OK) {
1578 Tcl_BackgroundException(interp, code);
15771579 }
15781580
15791581 Tcl_SetObjResult(interp, objPtr);
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkSelect.h,v 1.10 2008/09/03 06:01:52 dgp Exp $
11 * RCS: @(#) $Id: tkSelect.h,v 1.12 2008/10/29 13:28:06 dgp Exp $
1212 */
1313
1414 #ifndef _TKSELECT
7676 Atom selection; /* Selection being requested. */
7777 Atom property; /* Property where selection will appear. */
7878 Atom target; /* Desired form for selection. */
79 int (*proc) (ClientData clientData, Tcl_Interp *interp, char *portion); /* Procedure to call to handle pieces of
79 Tk_GetSelProc *proc; /* Procedure to call to handle pieces of
8080 * selection. */
8181 ClientData clientData; /* Argument for proc. */
8282 int result; /* Initially -1. Set to a Tcl return value
160160 MODULE_SCOPE int TkSelDefaultSelection(TkSelectionInfo *infoPtr,
161161 Atom target, char *buffer, int maxBytes,
162162 Atom *typePtr);
163 MODULE_SCOPE int TkSelGetSelection(Tcl_Interp *interp, Tk_Window tkwin,
164 Atom selection, Atom target, Tk_GetSelProc *proc,
165 ClientData clientData);
166163 #ifndef TkSelUpdateClipboard
167164 MODULE_SCOPE void TkSelUpdateClipboard(TkWindow *winPtr,
168165 TkClipboardTarget *targetPtr);
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkSquare.c,v 1.12 2008/07/23 23:24:21 nijtmans Exp $
14 * RCS: @(#) $Id: tkSquare.c,v 1.13 2008/10/17 23:18:37 nijtmans Exp $
1515 */
1616
1717 #if 0
223223 {
224224 Square *squarePtr = clientData;
225225 int result = TCL_OK;
226 static const char *squareOptions[] = {"cget", "configure", NULL};
226 static const char *const squareOptions[] = {"cget", "configure", NULL};
227227 enum {
228228 SQUARE_CGET, SQUARE_CONFIGURE
229229 };
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkStubInit.c,v 1.64 2008/08/19 15:52:12 georgeps Exp $
10 * RCS: @(#) $Id: tkStubInit.c,v 1.66 2008/12/04 21:33:25 nijtmans Exp $
1111 */
1212
1313 #include "tkInt.h"
308308 NULL, /* 155 */
309309 TkpTestembedCmd, /* 156 */
310310 TkpTesttextCmd, /* 157 */
311 TkSelGetSelection, /* 158 */
312 TkTextGetIndex, /* 159 */
313 TkTextIndexBackBytes, /* 160 */
314 TkTextIndexForwBytes, /* 161 */
315 TkTextMakeByteIndex, /* 162 */
316 TkTextPrintIndex, /* 163 */
317 TkTextSetMark, /* 164 */
318 TkTextXviewCmd, /* 165 */
319 TkTextChanged, /* 166 */
320 TkBTreeNumLines, /* 167 */
321 TkTextInsertDisplayProc, /* 168 */
311322 };
312323
313324 static const TkIntPlatStubs tkIntPlatStubs = {
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkStyle.c,v 1.9 2008/04/27 22:38:58 dkf Exp $
11 * RCS: @(#) $Id: tkStyle.c,v 1.11 2008/11/08 18:44:40 dkf Exp $
1212 */
1313
1414 #include "tkInt.h"
151151 * object points to the Style structure for the stylefont, or NULL.
152152 */
153153
154 static Tcl_ObjType styleObjType = {
154 static const Tcl_ObjType styleObjType = {
155155 "style", /* name */
156156 FreeStyleObjProc, /* freeIntRepProc */
157157 DupStyleObjProc, /* dupIntRepProc */
14961496 name = Tcl_GetString(objPtr);
14971497 typePtr = objPtr->typePtr;
14981498 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
1499 (*typePtr->freeIntRepProc)(objPtr);
1499 typePtr->freeIntRepProc(objPtr);
15001500 }
15011501
15021502 objPtr->typePtr = &styleObjType;
1212 * See the file "license.terms" for information on usage and redistribution of
1313 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1414 *
15 * RCS: @(#) $Id: tkTest.c,v 1.38 2008/10/05 18:22:21 dkf Exp $
15 * RCS: @(#) $Id: tkTest.c,v 1.41 2008/11/12 00:15:26 nijtmans Exp $
1616 */
1717
1818 #include "tkInt.h"
6060 */
6161
6262 static int ImageCreate(Tcl_Interp *interp,
63 char *name, int argc, Tcl_Obj *const objv[],
64 Tk_ImageType *typePtr, Tk_ImageMaster master,
63 const char *name, int argc, Tcl_Obj *const objv[],
64 const Tk_ImageType *typePtr, Tk_ImageMaster master,
6565 ClientData *clientDataPtr);
6666 static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
6767 static void ImageDisplay(ClientData clientData,
619619 int objc, /* Number of arguments. */
620620 Tcl_Obj *const objv[]) /* Argument objects. */
621621 {
622 static const char *options[] = {
622 static const char *const options[] = {
623623 "alltypes", "chain1", "chain2", "configerror", "delete", "info",
624624 "internal", "new", "notenoughparams", "twowindows", NULL
625625 };
698698 Tcl_Obj *customPtr;
699699 } TypesRecord;
700700 TypesRecord *recordPtr;
701 static char *stringTable[] = {
701 static const char *const stringTable[] = {
702702 "one", "two", "three", "four", NULL
703703 };
704704 static const Tk_OptionSpec typesSpecs[] = {
971971 char *custom;
972972 } InternalRecord;
973973 InternalRecord *recordPtr;
974 static char *internalStringTable[] = {
974 static const char *const internalStringTable[] = {
975975 "one", "two", "three", "four", NULL
976976 };
977977 static const Tk_OptionSpec internalSpecs[] = {
12511251 Tcl_Obj *const objv[]) /* Argument objects. */
12521252 {
12531253 int result = TCL_OK;
1254 static const char *options[] = {
1254 static const char *const options[] = {
12551255 "cget", "configure", "csave", NULL
12561256 };
12571257 enum {
14331433 int objc, /* Number of arguments. */
14341434 Tcl_Obj *const objv[]) /* Argument objects. */
14351435 {
1436 static const char *options[] = {"counts", "subfonts", NULL};
1436 static const char *const options[] = {"counts", "subfonts", NULL};
14371437 enum option {COUNTS, SUBFONTS};
14381438 int index;
14391439 Tk_Window tkwin;
14901490 ImageCreate(
14911491 Tcl_Interp *interp, /* Interpreter for application containing
14921492 * image. */
1493 char *name, /* Name to use for image. */
1493 const char *name, /* Name to use for image. */
14941494 int objc, /* Number of arguments. */
14951495 Tcl_Obj *const objv[], /* Argument strings for options (doesn't
14961496 * include image name or type). */
1497 Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
1497 const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
14981498 Tk_ImageMaster master, /* Token for image, to be used by us in later
14991499 * callbacks. */
15001500 ClientData *clientDataPtr) /* Store manager's token for image here; it
15011501 * will be returned in later callbacks. */
15021502 {
15031503 TImageMaster *timPtr;
1504 char *varName;
1504 const char *varName;
15051505 int i;
15061506
15071507 varName = "log";
1212 * See the file "license.terms" for information on usage and redistribution of
1313 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1414 *
15 * RCS: @(#) $Id: tkText.c,v 1.81 2008/07/23 23:24:22 nijtmans Exp $
15 * RCS: @(#) $Id: tkText.c,v 1.87 2008/12/07 16:32:44 das Exp $
1616 */
1717
1818 #include "default.h"
4949 * table below.
5050 */
5151
52 static char *stateStrings[] = {
52 static const char *const stateStrings[] = {
5353 "disabled", "normal", NULL
5454 };
5555
5959 * table below.
6060 */
6161
62 static char *wrapStrings[] = {
62 static const char *const wrapStrings[] = {
6363 "char", "none", "word", NULL
6464 };
6565
6969 * the string table below.
7070 */
7171
72 static char *tabStyleStrings[] = {
72 static const char *const tabStyleStrings[] = {
7373 "tabular", "wordprocessor", NULL
74 };
75
76 /*
77 * The 'TkTextInsertUnfocussed' enum in tkText.h is used to define a type for
78 * the -insertunfocussed option of the Text widget. These values are used as
79 * indice into the string table below.
80 */
81
82 static const char *const insertUnfocussedStrings[] = {
83 "hollow", "none", "solid", NULL
7484 };
7585
7686 /*
176186 {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
177187 DEF_TEXT_INSERT_ON_TIME, -1, Tk_Offset(TkText, insertOnTime),
178188 0, 0, 0},
189 {TK_OPTION_STRING_TABLE,
190 "-insertunfocussed", "insertUnfocussed", "InsertUnfocussed",
191 DEF_TEXT_INSERT_UNFOCUSSED, -1, Tk_Offset(TkText, insertUnfocussed),
192 0, (ClientData) insertUnfocussedStrings, 0},
179193 {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
180194 DEF_TEXT_INSERT_WIDTH, -1, Tk_Offset(TkText, insertWidth),
181195 0, 0, 0},
442456 int objc, /* Number of arguments. */
443457 Tcl_Obj *const objv[]) /* Argument objects. */
444458 {
445 Tk_Window tkwin = (Tk_Window) clientData;
459 Tk_Window tkwin = clientData;
446460
447461 if (objc < 2) {
448462 Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
512526 textPtr->interp = interp;
513527 textPtr->widgetCmd = Tcl_CreateObjCommand(interp,
514528 Tk_PathName(textPtr->tkwin), TextWidgetObjCmd,
515 (ClientData) textPtr, TextCmdDeletedProc);
529 textPtr, TextCmdDeletedProc);
516530
517531 if (sharedPtr == NULL) {
518532 sharedPtr = (TkSharedText *) ckalloc(sizeof(TkSharedText));
627641 optionTable = Tk_CreateOptionTable(interp, optionSpecs);
628642
629643 Tk_SetClass(textPtr->tkwin, "Text");
630 Tk_SetClassProcs(textPtr->tkwin, &textClass, (ClientData) textPtr);
644 Tk_SetClassProcs(textPtr->tkwin, &textClass, textPtr);
631645 textPtr->optionTable = optionTable;
632646
633647 Tk_CreateEventHandler(textPtr->tkwin,
634648 ExposureMask|StructureNotifyMask|FocusChangeMask,
635 TextEventProc, (ClientData) textPtr);
649 TextEventProc, textPtr);
636650 Tk_CreateEventHandler(textPtr->tkwin, KeyPressMask|KeyReleaseMask
637651 |ButtonPressMask|ButtonReleaseMask|EnterWindowMask
638652 |LeaveWindowMask|PointerMotionMask|VirtualEventMask,
639 TkTextBindProc, (ClientData) textPtr);
653 TkTextBindProc, textPtr);
640654 Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING,
641 TextFetchSelection, (ClientData) textPtr, XA_STRING);
655 TextFetchSelection, textPtr, XA_STRING);
642656
643657 if (Tk_InitOptions(interp, (char *) textPtr, optionTable, textPtr->tkwin)
644658 != TCL_OK) {
650664 return TCL_ERROR;
651665 }
652666
653 Tcl_SetObjResult(interp,
654 Tcl_NewStringObj(Tk_PathName(textPtr->tkwin),-1));
667 Tcl_SetObjResult(interp, TkNewWindowObj(textPtr->tkwin));
655668 return TCL_OK;
656669 }
657670
680693 int objc, /* Number of arguments. */
681694 Tcl_Obj *const objv[]) /* Argument objects. */
682695 {
683 register TkText *textPtr = (TkText *) clientData;
696 register TkText *textPtr = clientData;
684697 int result = TCL_OK;
685698 int index;
686699
687 static const char *optionStrings[] = {
700 static const char *const optionStrings[] = {
688701 "bbox", "cget", "compare", "configure", "count", "debug", "delete",
689702 "dlineinfo", "dump", "edit", "get", "image", "index", "insert",
690703 "mark", "peer", "replace", "scan", "search", "see", "tag", "window",
15311544 int objc, /* Number of arguments. */
15321545 Tcl_Obj *const objv[]) /* Argument objects. */
15331546 {
1534 register TkSharedText *sharedPtr = (TkSharedText *) clientData;
1547 register TkSharedText *sharedPtr = clientData;
15351548 int result = TCL_OK;
15361549 int index;
15371550
1538 static const char *optionStrings[] = {
1551 static const char *const optionStrings[] = {
15391552 "delete", "insert", NULL
15401553 };
15411554 enum options {
16401653 Tk_Window tkwin = textPtr->tkwin;
16411654 int index;
16421655
1643 static const char *peerOptionStrings[] = {
1656 static const char *const peerOptionStrings[] = {
16441657 "create", "names", NULL
16451658 };
16461659 enum peerOptions {
21962209 if (TkBTreeCharTagged(&first, textPtr->selTagPtr)
21972210 || TkBTreeNextTag(&search)) {
21982211 Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY, TkTextLostSelection,
2199 (ClientData) textPtr);
2212 textPtr);
22002213 textPtr->flags |= GOT_SELECTION;
22012214 }
22022215 }
22072220
22082221 if (textPtr->flags & GOT_FOCUS) {
22092222 Tcl_DeleteTimerHandler(textPtr->insertBlinkHandler);
2210 textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
2211 TextBlinkProc((ClientData) textPtr);
2223 textPtr->insertBlinkHandler = NULL;
2224 TextBlinkProc(textPtr);
22122225 }
22132226
22142227 /*
22512264 TextWorldChangedCallback(
22522265 ClientData instanceData) /* Information about widget. */
22532266 {
2254 TkText *textPtr;
2255
2256 textPtr = (TkText *) instanceData;
2267 TkText *textPtr = instanceData;
2268
22572269 TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY);
22582270 }
22592271
23392351 ClientData clientData, /* Information about window. */
23402352 register XEvent *eventPtr) /* Information about event. */
23412353 {
2342 register TkText *textPtr = (TkText *) clientData;
2354 register TkText *textPtr = clientData;
23432355 TkTextIndex index, index2;
23442356
23452357 if (eventPtr->type == Expose) {
23992411 textPtr->flags |= GOT_FOCUS | INSERT_ON;
24002412 if (textPtr->insertOffTime != 0) {
24012413 textPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
2402 textPtr->insertOnTime, TextBlinkProc,
2403 (ClientData) textPtr);
2414 textPtr->insertOnTime, TextBlinkProc, textPtr);
24042415 }
24052416 } else {
24062417 textPtr->flags &= ~(GOT_FOCUS | INSERT_ON);
2407 textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
2418 textPtr->insertBlinkHandler = NULL;
24082419 }
24092420 if (textPtr->inactiveSelBorder != textPtr->selBorder) {
24102421 TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr,
24492460 TextCmdDeletedProc(
24502461 ClientData clientData) /* Pointer to widget record for widget. */
24512462 {
2452 TkText *textPtr = (TkText *) clientData;
2463 TkText *textPtr = clientData;
24532464 Tk_Window tkwin = textPtr->tkwin;
24542465
24552466 /*
26522663
26532664 Tcl_Obj *seeInsertObj = Tcl_NewObj();
26542665 Tcl_Obj *markSet1InsertObj = Tcl_NewObj();
2655 Tcl_Obj *markSet2InsertObj = Tcl_NewObj();
2666 Tcl_Obj *markSet2InsertObj = NULL;
26562667 Tcl_Obj *insertCmdObj = Tcl_NewObj();
26572668 Tcl_Obj *deleteCmdObj = Tcl_NewObj();
26582669
27172728 * underlying data shared by all peers.
27182729 */
27192730
2720 iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback,
2721 (ClientData)textPtr->sharedTextPtr, insertCmdObj, NULL);
2731 iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr,
2732 insertCmdObj, NULL);
27222733 TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom);
27232734 TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom);
27242735
2725 dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback,
2726 (ClientData)textPtr->sharedTextPtr, deleteCmdObj, NULL);
2736 dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr,
2737 deleteCmdObj, NULL);
27272738 TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom);
27282739 TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom);
27292740
27722783 Tcl_Obj *objPtr) /* Arguments of a command to be handled by the
27732784 * shared text data structure. */
27742785 {
2775 TkSharedText *sharedPtr = (TkSharedText *) clientData;
2786 TkSharedText *sharedPtr = clientData;
27762787 int res, objc;
27772788 Tcl_Obj **objv;
27782789 TkText *textPtr;
28372848 * the Tcl level.
28382849 */
28392850
2840 return SharedTextObjCmd((ClientData)sharedPtr, interp, objc+1, objv-1);
2851 return SharedTextObjCmd(sharedPtr, interp, objc+1, objv-1);
28412852 }
28422853
28432854 /*
31983209 * not including terminating NULL
31993210 * character. */
32003211 {
3201 register TkText *textPtr = (TkText *) clientData;
3212 register TkText *textPtr = clientData;
32023213 TkTextIndex eof;
32033214 int count, chunkSize, offsetInSeg;
32043215 TkTextSearch search;
33293340 TkTextLostSelection(
33303341 ClientData clientData) /* Information about text widget. */
33313342 {
3332 register TkText *textPtr = (TkText *) clientData;
3343 register TkText *textPtr = clientData;
33333344
33343345 if (TkpAlwaysShowSelection(textPtr->tkwin)) {
33353346 TkTextIndex start, end;
34233434 TextBlinkProc(
34243435 ClientData clientData) /* Pointer to record describing text. */
34253436 {
3426 register TkText *textPtr = (TkText *) clientData;
3437 register TkText *textPtr = clientData;
34273438 TkTextIndex index;
34283439 int x, y, w, h, charWidth;
34293440
34303441 if ((textPtr->state == TK_TEXT_STATE_DISABLED) ||
34313442 !(textPtr->flags & GOT_FOCUS) || (textPtr->insertOffTime == 0)) {
3443 if (!(textPtr->flags & GOT_FOCUS) &&
3444 (textPtr->insertUnfocussed != TK_TEXT_INSERT_NOFOCUS_NONE)) {
3445 /*
3446 * The widget doesn't have the focus yet it is configured to
3447 * display the cursor when it doesn't have the focus. Act now!
3448 */
3449
3450 textPtr->flags |= INSERT_ON;
3451 goto redrawInsert;
3452 }
34323453 if ((textPtr->insertOffTime == 0) && !(textPtr->flags & INSERT_ON)) {
34333454 /*
34343455 * The widget was configured to have zero offtime while the
34433464 if (textPtr->flags & INSERT_ON) {
34443465 textPtr->flags &= ~INSERT_ON;
34453466 textPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
3446 textPtr->insertOffTime, TextBlinkProc, (ClientData) textPtr);
3467 textPtr->insertOffTime, TextBlinkProc, textPtr);
34473468 } else {
34483469 textPtr->flags |= INSERT_ON;
34493470 textPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
3450 textPtr->insertOnTime, TextBlinkProc, (ClientData) textPtr);
3471 textPtr->insertOnTime, TextBlinkProc, textPtr);
34513472 }
34523473 redrawInsert:
34533474 TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
35743595 int i, argsLeft, code;
35753596 SearchSpec searchSpec;
35763597
3577 static const char *switchStrings[] = {
3598 static const char *const switchStrings[] = {
35783599 "--", "-all", "-backwards", "-count", "-elide", "-exact", "-forwards",
35793600 "-hidden", "-nocase", "-nolinestop", "-overlap", "-regexp",
35803601 "-strictlimits", NULL
36033624 searchSpec.strictLimits = 0;
36043625 searchSpec.numLines =
36053626 TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
3606 searchSpec.clientData = (ClientData)textPtr;
3627 searchSpec.clientData = textPtr;
36073628 searchSpec.addLineProc = &TextSearchAddNextLine;
36083629 searchSpec.foundMatchProc = &TextSearchFoundMatch;
36093630 searchSpec.lineIndexProc = &TextSearchGetLineIndex;
37883809 {
37893810 const TkTextIndex *indexPtr;
37903811 int line;
3791 TkText *textPtr = (TkText *) searchSpecPtr->clientData;
3812 TkText *textPtr = searchSpecPtr->clientData;
37923813
37933814 indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr);
37943815 if (indexPtr == NULL) {
38533874 TkTextSegment *segPtr;
38543875 TkTextIndex curIndex;
38553876 int index, leftToScan;
3856 TkText *textPtr = (TkText *) searchSpecPtr->clientData;
3877 TkText *textPtr = searchSpecPtr->clientData;
38573878
38583879 index = 0;
38593880 curIndex.tree = textPtr->sharedTextPtr->tree;
39233944 TkTextLine *linePtr, *thisLinePtr;
39243945 TkTextIndex curIndex;
39253946 TkTextSegment *segPtr;
3926 TkText *textPtr = (TkText *) searchSpecPtr->clientData;
3947 TkText *textPtr = searchSpecPtr->clientData;
39273948 int nothingYet = 1;
39283949
39293950 /*
40004021 *lenPtr = Tcl_GetCharLength(theLine);
40014022 }
40024023 }
4003 return (ClientData)linePtr;
4024 return linePtr;
40044025 }
40054026
40064027 /*
40444065 TkTextIndex curIndex, foundIndex;
40454066 TkTextSegment *segPtr;
40464067 TkTextLine *linePtr;
4047 TkText *textPtr = (TkText *) searchSpecPtr->clientData;
4068 TkText *textPtr = searchSpecPtr->clientData;
40484069
40494070 if (lineNum == searchSpecPtr->stopLine) {
40504071 /*
40954116 * reached the end of the match or we have reached the end of the line.
40964117 */
40974118
4098 linePtr = (TkTextLine *)clientData;
4119 linePtr = clientData;
40994120 if (linePtr == NULL) {
41004121 linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
41014122 lineNum);
42764297 /*
42774298 * Map these strings to TkTextTabAlign values.
42784299 */
4279 static const char *tabOptionStrings[] = {
4300 static const char *const tabOptionStrings[] = {
42804301 "left", "right", "center", "numeric", NULL
42814302 };
42824303
43254346 }
43264347
43274348 prevStop = lastStop;
4328 if (Tk_GetMMFromObj(interp, textPtr->tkwin, objv[i],
4329 &lastStop) != TCL_OK) {
4349 if (Tk_GetDoublePixelsFromObj (interp, textPtr->tkwin, objv[i],
4350 &lastStop) != TCL_OK) {
43304351 goto error;
43314352 }
4332 lastStop *= WidthOfScreen(Tk_Screen(textPtr->tkwin));
4333 lastStop /= WidthMMOfScreen(Tk_Screen(textPtr->tkwin));
43344353
43354354 if (i > 0 && (tabPtr->location <= (tabPtr-1)->location)) {
43364355 /*
44484467 #define TK_DUMP_IMG 0x10
44494468 #define TK_DUMP_ALL (TK_DUMP_TEXT|TK_DUMP_MARK|TK_DUMP_TAG| \
44504469 TK_DUMP_WIN|TK_DUMP_IMG)
4451 static const char *optStrings[] = {
4470 static const char *const optStrings[] = {
44524471 "-all", "-command", "-image", "-mark", "-tag", "-text", "-window",
44534472 NULL
44544473 };
46844703 }
46854704 } else if ((offset >= startByte)) {
46864705 if ((what & TK_DUMP_MARK) && (segPtr->typePtr->name[0] == 'm')) {
4687 char *name;
4706 const char *name;
46884707 TkTextMark *markPtr = (TkTextMark *) &segPtr->body;
46894708
46904709 if (segPtr == textPtr->insertMarkPtr) {
47164735 } else if ((what & TK_DUMP_IMG) &&
47174736 (segPtr->typePtr->name[0] == 'i')) {
47184737 TkTextEmbImage *eiPtr = (TkTextEmbImage *)&segPtr->body;
4719 char *name = (eiPtr->name == NULL) ? "" : eiPtr->name;
4738 const char *name = (eiPtr->name == NULL) ? "" : eiPtr->name;
47204739
47214740 TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
47224741 lineno, offset, &index);
47254744 } else if ((what & TK_DUMP_WIN) &&
47264745 (segPtr->typePtr->name[0] == 'w')) {
47274746 TkTextEmbWindow *ewPtr = (TkTextEmbWindow *)&segPtr->body;
4728 char *pathname;
4747 const char *pathname;
47294748
47304749 if (ewPtr->tkwin == (Tk_Window) NULL) {
47314750 pathname = "";
49594978 {
49604979 int index;
49614980
4962 static const char *editOptionStrings[] = {
4981 static const char *const editOptionStrings[] = {
49634982 "modified", "redo", "reset", "separator", "undo", NULL
49644983 };
49654984 enum editOptions {
52395258 * for regexp search, utf-8 bytes for exact search).
52405259 */
52415260
5242 if ((*searchSpecPtr->lineIndexProc)(interp, fromPtr, searchSpecPtr,
5261 if (searchSpecPtr->lineIndexProc(interp, fromPtr, searchSpecPtr,
52435262 &searchSpecPtr->startLine,
52445263 &searchSpecPtr->startOffset) != TCL_OK) {
52455264 return TCL_ERROR;
52515270
52525271 if (toPtr != NULL) {
52535272 const TkTextIndex *indexToPtr, *indexFromPtr;
5254 TkText *textPtr = (TkText *) searchSpecPtr->clientData;
5273 TkText *textPtr = searchSpecPtr->clientData;
52555274
52565275 indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr);
52575276 if (indexToPtr == NULL) {
52755294 }
52765295 }
52775296
5278 if ((*searchSpecPtr->lineIndexProc)(interp, toPtr, searchSpecPtr,
5297 if (searchSpecPtr->lineIndexProc(interp, toPtr, searchSpecPtr,
52795298 &searchSpecPtr->stopLine,
52805299 &searchSpecPtr->stopOffset) != TCL_OK) {
52815300 return TCL_ERROR;
54615480 * this line, which is what 'lastOffset' represents.
54625481 */
54635482
5464 lineInfo = (*searchSpecPtr->addLineProc)(lineNum, searchSpecPtr,
5465 theLine, &lastOffset, &linesSearched);
5483 lineInfo = searchSpecPtr->addLineProc(lineNum, searchSpecPtr, theLine,
5484 &lastOffset, &linesSearched);
54665485
54675486 if (lineInfo == NULL) {
54685487 /*
56465665 */
56475666
56485667 if (extraLines > maxExtraLines) {
5649 if ((*searchSpecPtr->addLineProc)(lineNum
5668 if (searchSpecPtr->addLineProc(lineNum
56505669 + extraLines, searchSpecPtr, theLine,
56515670 &lastTotal, &extraLines) == NULL) {
56525671 p = NULL;
57265745 matchOffset = p - startOfLine;
57275746
57285747 if (searchSpecPtr->all &&
5729 !(*searchSpecPtr->foundMatchProc)(lineNum,
5730 searchSpecPtr, lineInfo, theLine, matchOffset,
5731 matchLength)) {
5748 !searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr,
5749 lineInfo, theLine, matchOffset, matchLength)) {
57325750 /*
57335751 * We reached the end of the search.
57345752 */
58695887 */
58705888
58715889 if (extraLines > maxExtraLines) {
5872 if ((*searchSpecPtr->addLineProc)(lineNum
5890 if (searchSpecPtr->addLineProc(lineNum
58735891 + extraLines, searchSpecPtr, theLine,
58745892 &lastTotal, &extraLines) == NULL) {
58755893 /*
60486066
60496067 if (lastBackwardsLineMatch != -1) {
60506068 recordBackwardsMatch:
6051 (*searchSpecPtr->foundMatchProc)(
6052 lastBackwardsLineMatch, searchSpecPtr, NULL,
6053 NULL, lastBackwardsMatchOffset, matchLength);
6069 searchSpecPtr->foundMatchProc(lastBackwardsLineMatch,
6070 searchSpecPtr, NULL, NULL,
6071 lastBackwardsMatchOffset, matchLength);
60546072 lastBackwardsLineMatch = -1;
60556073 if (!searchSpecPtr->all) {
60566074 goto searchDone;
61156133 */
61166134
61176135 if (searchSpecPtr->all &&
6118 !(*searchSpecPtr->foundMatchProc)(lineNum,
6136 !searchSpecPtr->foundMatchProc(lineNum,
61196137 searchSpecPtr, lineInfo, theLine, matchOffset,
61206138 matchLength)) {
61216139 /*
62066224 continue;
62076225 }
62086226 }
6209 (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr,
6227 searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr,
62106228 lineInfo, theLine, matchOffset, matchLength);
62116229 if (!searchSpecPtr->all) {
62126230 goto searchDone;
62216239 * non-all case.
62226240 */
62236241
6224 (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr,
6242 searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr,
62256243 lineInfo, theLine, matchOffset, matchLength);
62266244 } else {
62276245 lastBackwardsLineMatch = lineNum;
62406258
62416259 if ((lastBackwardsLineMatch == -1) && (matchOffset >= 0)
62426260 && !searchSpecPtr->all) {
6243 (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr, lineInfo,
6261 searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo,
62446262 theLine, matchOffset, matchLength);
62456263 goto searchDone;
62466264 }
62676285 if (lastBackwardsLineMatch != -1
62686286 && ((lineNum < 0)
62696287 || (lineNum + 2 < lastBackwardsLineMatch))) {
6270 (*searchSpecPtr->foundMatchProc)(lastBackwardsLineMatch,
6288 searchSpecPtr->foundMatchProc(lastBackwardsLineMatch,
62716289 searchSpecPtr, NULL, NULL,
62726290 lastBackwardsMatchOffset, matchLength);
62736291 lastBackwardsLineMatch = -1;
63136331 searchDone:
63146332
63156333 if (lastBackwardsLineMatch != -1) {
6316 (*searchSpecPtr->foundMatchProc)(lastBackwardsLineMatch, searchSpecPtr,
6334 searchSpecPtr->foundMatchProc(lastBackwardsLineMatch, searchSpecPtr,
63176335 NULL, NULL, lastBackwardsMatchOffset, matchLength);
63186336 }
63196337
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkText.h,v 1.34 2007/12/13 15:24:17 dgp Exp $
11 * RCS: @(#) $Id: tkText.h,v 1.36 2008/12/06 10:48:29 dkf Exp $
1212 */
1313
1414 #ifndef _TKTEXT
2626 # undef TCL_STORAGE_CLASS
2727 # define TCL_STORAGE_CLASS DLLEXPORT
2828 #endif
29
30 /*
31 * Opaque types for structures whose guts are only needed by a single file.
32 */
33
34 typedef struct TkTextBTree_ *TkTextBTree;
3529
3630 /*
3731 * The data structure below defines a single logical line of text (from
584578 } TkSharedText;
585579
586580 /*
581 * The following enum is used to define a type for the -insertunfocussed
582 * option of the Text widget.
583 */
584
585 typedef enum {
586 TK_TEXT_INSERT_NOFOCUS_HOLLOW,
587 TK_TEXT_INSERT_NOFOCUS_NONE,
588 TK_TEXT_INSERT_NOFOCUS_SOLID
589 } TkTextInsertUnfocussed;
590
591 /*
587592 * A data structure of the following type is kept for each text widget that
588593 * currently exists for this process:
589594 */
715720 Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion
716721 * cursor. */
717722 int insertWidth; /* Total width of insert cursor. */
718 int insertBorderWidth; /* Width of 3-D border around insert cursor. */
723 int insertBorderWidth; /* Width of 3-D border around insert cursor */
724 TkTextInsertUnfocussed insertUnfocussed;
725 /* How to display the insert cursor when the
726 * text widget does not have the focus. */
719727 int insertOnTime; /* Number of milliseconds cursor should spend
720728 * in "on" state for each blink. */
721729 int insertOffTime; /* Number of milliseconds cursor should spend
9951003 MODULE_SCOPE TkTextLine *TkBTreeNextLine(const TkText *textPtr,
9961004 TkTextLine *linePtr);
9971005 MODULE_SCOPE int TkBTreeNextTag(TkTextSearch *searchPtr);
998 MODULE_SCOPE int TkBTreeNumLines(TkTextBTree tree,
999 const TkText *textPtr);
10001006 MODULE_SCOPE int TkBTreeNumPixels(TkTextBTree tree,
10011007 const TkText *textPtr);
10021008 MODULE_SCOPE TkTextLine *TkBTreePreviousLine(TkText *textPtr,
10161022 MODULE_SCOPE void TkTextBindProc(ClientData clientData,
10171023 XEvent *eventPtr);
10181024 MODULE_SCOPE void TkTextSelectionEvent(TkText *textPtr);
1019 MODULE_SCOPE void TkTextChanged(TkSharedText *sharedTextPtr,
1020 TkText *textPtr, const TkTextIndex *index1Ptr,
1021 const TkTextIndex *index2Ptr);
10221025 MODULE_SCOPE int TkTextIndexBbox(TkText *textPtr,
10231026 const TkTextIndex *indexPtr, int *xPtr, int *yPtr,
10241027 int *widthPtr, int *heightPtr, int *charWidthPtr);
10391042 MODULE_SCOPE void TkTextFreeDInfo(TkText *textPtr);
10401043 MODULE_SCOPE void TkTextDeleteTag(TkText *textPtr, TkTextTag *tagPtr);
10411044 MODULE_SCOPE void TkTextFreeTag(TkText *textPtr, TkTextTag *tagPtr);
1042 MODULE_SCOPE int TkTextGetIndex(Tcl_Interp *interp, TkText *textPtr,
1043 const char *string, TkTextIndex *indexPtr);
10441045 MODULE_SCOPE int TkTextGetObjIndex(Tcl_Interp *interp, TkText *textPtr,
10451046 Tcl_Obj *idxPtr, TkTextIndex *indexPtr);
10461047 MODULE_SCOPE int TkTextSharedGetObjIndex(Tcl_Interp *interp,
10521053 TkText *textPtr, Tcl_Obj *stringPtr);
10531054 MODULE_SCOPE void TkTextFindDisplayLineEnd(TkText *textPtr,
10541055 TkTextIndex *indexPtr, int end, int *xOffset);
1055 MODULE_SCOPE int TkTextIndexBackBytes(const TkText *textPtr,
1056 const TkTextIndex *srcPtr, int count,
1057 TkTextIndex *dstPtr);
10581056 MODULE_SCOPE void TkTextIndexBackChars(const TkText *textPtr,
10591057 const TkTextIndex *srcPtr, int count,
10601058 TkTextIndex *dstPtr, TkTextCountType type);
10641062 const TkTextIndex *index1Ptr,
10651063 const TkTextIndex *index2Ptr,
10661064 TkTextCountType type);
1067 MODULE_SCOPE int TkTextIndexForwBytes(const TkText *textPtr,
1068 const TkTextIndex *srcPtr, int count,
1069 TkTextIndex *dstPtr);
10701065 MODULE_SCOPE void TkTextIndexForwChars(const TkText *textPtr,
10711066 const TkTextIndex *srcPtr, int count,
10721067 TkTextIndex *dstPtr, TkTextCountType type);
10761071 const TkTextIndex *indexPtr);
10771072 MODULE_SCOPE TkTextSegment *TkTextIndexToSeg(const TkTextIndex *indexPtr,
10781073 int *offsetPtr);
1079 MODULE_SCOPE void TkTextInsertDisplayProc(TkText *textPtr,
1080 TkTextDispChunk *chunkPtr, int x, int y,
1081 int height, int baseline, Display *display,
1082 Drawable dst, int screenY);
10831074 MODULE_SCOPE void TkTextLostSelection(ClientData clientData);
10841075 MODULE_SCOPE TkTextIndex *TkTextMakeCharIndex(TkTextBTree tree, TkText *textPtr,
10851076 int lineIndex, int charIndex,
10901081 MODULE_SCOPE int TkTextIsElided(const TkText *textPtr,
10911082 const TkTextIndex *indexPtr,
10921083 TkTextElideInfo *infoPtr);
1093 MODULE_SCOPE TkTextIndex *TkTextMakeByteIndex(TkTextBTree tree,
1094 const TkText *textPtr, int lineIndex,
1095 int byteIndex, TkTextIndex *indexPtr);
10961084 MODULE_SCOPE int TkTextMakePixelIndex(TkText *textPtr,
10971085 int pixelIndex, TkTextIndex *indexPtr);
10981086 MODULE_SCOPE void TkTextInvalidateLineMetrics(
11131101 MODULE_SCOPE void TkTextPickCurrent(TkText *textPtr, XEvent *eventPtr);
11141102 MODULE_SCOPE void TkTextPixelIndex(TkText *textPtr, int x, int y,
11151103 TkTextIndex *indexPtr, int *nearest);
1116 MODULE_SCOPE int TkTextPrintIndex(const TkText *textPtr,
1117 const TkTextIndex *indexPtr, char *string);
11181104 MODULE_SCOPE Tcl_Obj * TkTextNewIndexObj(TkText *textPtr,
11191105 const TkTextIndex *indexPtr);
11201106 MODULE_SCOPE void TkTextRedrawRegion(TkText *textPtr, int x, int y,
11301116 int objc, Tcl_Obj *const objv[]);
11311117 MODULE_SCOPE int TkTextSegToOffset(const TkTextSegment *segPtr,
11321118 const TkTextLine *linePtr);
1133 MODULE_SCOPE TkTextSegment *TkTextSetMark(TkText *textPtr,
1134 const char *name, TkTextIndex *indexPtr);
11351119 MODULE_SCOPE void TkTextSetYView(TkText *textPtr,
11361120 TkTextIndex *indexPtr, int pickPlace);
11371121 MODULE_SCOPE int TkTextTagCmd(TkText *textPtr, Tcl_Interp *interp,
11441128 int objc, Tcl_Obj *const objv[]);
11451129 MODULE_SCOPE int TkTextWindowIndex(TkText *textPtr, const char *name,
11461130 TkTextIndex *indexPtr);
1147 MODULE_SCOPE int TkTextXviewCmd(TkText *textPtr, Tcl_Interp *interp,
1148 int objc, Tcl_Obj *const objv[]);
11491131 MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp,
11501132 int objc, Tcl_Obj *const objv[]);
11511133 MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr,
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkTextBTree.c,v 1.27 2007/12/13 15:24:17 dgp Exp $
13 * RCS: @(#) $Id: tkTextBTree.c,v 1.28 2008/11/08 18:44:40 dkf Exp $
1414 */
1515
1616 #include "tkInt.h"
866866 while (linePtr->segPtr != NULL) {
867867 segPtr = linePtr->segPtr;
868868 linePtr->segPtr = segPtr->nextPtr;
869 (*segPtr->typePtr->deleteProc)(segPtr, linePtr, 1);
869 segPtr->typePtr->deleteProc(segPtr, linePtr, 1);
870870 }
871871 ckfree((char *) linePtr->pixels);
872872 ckfree((char *) linePtr);
12061206 if (count == 0) {
12071207 return prevPtr;
12081208 }
1209 segPtr = (*segPtr->typePtr->splitProc)(segPtr, count);
1209 segPtr = segPtr->typePtr->splitProc(segPtr, count);
12101210 if (prevPtr == NULL) {
12111211 indexPtr->linePtr->segPtr = segPtr;
12121212 } else {
12811281 segPtr != NULL;
12821282 prevPtrPtr = &(*prevPtrPtr)->nextPtr, segPtr = *prevPtrPtr) {
12831283 if (segPtr->typePtr->cleanupProc != NULL) {
1284 *prevPtrPtr = (*segPtr->typePtr->cleanupProc)(segPtr, linePtr);
1284 *prevPtrPtr = segPtr->typePtr->cleanupProc(segPtr, linePtr);
12851285 if (segPtr != *prevPtrPtr) {
12861286 anyChanges = 1;
12871287 }
14511451 }
14521452
14531453 nextPtr = segPtr->nextPtr;
1454 if ((*segPtr->typePtr->deleteProc)(segPtr, curLinePtr, 0) != 0) {
1454 if (segPtr->typePtr->deleteProc(segPtr, curLinePtr, 0) != 0) {
14551455 /*
14561456 * This segment refuses to die. Move it to prevPtr and advance
14571457 * prevPtr if the segment has left gravity.
14821482 for (segPtr = lastPtr; segPtr != NULL;
14831483 segPtr = segPtr->nextPtr) {
14841484 if (segPtr->typePtr->lineChangeProc != NULL) {
1485 (*segPtr->typePtr->lineChangeProc)(segPtr, index2Ptr->linePtr);
1485 segPtr->typePtr->lineChangeProc(segPtr, index2Ptr->linePtr);
14861486 }
14871487 }
14881488 curNodePtr = index2Ptr->linePtr->parentPtr;
39343934 for (segPtr = linePtr->segPtr; segPtr != NULL;
39353935 segPtr = segPtr->nextPtr) {
39363936 if (segPtr->typePtr->checkProc != NULL) {
3937 (*segPtr->typePtr->checkProc)(segPtr, linePtr);
3937 segPtr->typePtr->checkProc(segPtr, linePtr);
39383938 }
39393939 if ((segPtr->size == 0) && (!segPtr->typePtr->leftGravity)
39403940 && (segPtr->nextPtr != NULL)
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkTextDisp.c,v 1.69 2008/04/27 22:38:58 dkf Exp $
14 * RCS: @(#) $Id: tkTextDisp.c,v 1.72 2008/12/09 21:22:56 dgp Exp $
1515 */
1616
1717 #include "tkInt.h"
445445 * LayoutDLine(). */
446446 } BaseCharInfo;
447447
448 /* TODO: Thread safety */
448449 static TkTextDispChunk *baseCharChunkPtr = NULL;
449450
450451 #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
660661
661662 textPtr->refCount++;
662663 dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(0,
663 AsyncUpdateLineMetrics, (ClientData) textPtr);
664 AsyncUpdateLineMetrics, textPtr);
664665 textPtr->refCount++;
665666 dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200,
666 AsyncUpdateYScrollbar, (ClientData) textPtr);
667 AsyncUpdateYScrollbar, textPtr);
667668
668669 textPtr->dInfoPtr = dInfoPtr;
669670 }
705706 }
706707 Tk_FreeGC(textPtr->display, dInfoPtr->scrollGC);
707708 if (dInfoPtr->flags & REDRAW_PENDING) {
708 Tcl_CancelIdleCall(DisplayText, (ClientData) textPtr);
709 Tcl_CancelIdleCall(DisplayText, textPtr);
709710 }
710711 if (dInfoPtr->lineUpdateTimer != NULL) {
711712 Tcl_DeleteTimerHandler(dInfoPtr->lineUpdateTimer);
12641265 */
12651266
12661267 TkTextLine *linePtr = TkBTreeNextLine(NULL, curIndex.linePtr);
1267 if (linePtr != NULL) {
1268 dlPtr->logicalLinesMerged++;
1269 curIndex.byteIndex = 0;
1270 curIndex.linePtr = linePtr;
1271 segPtr = curIndex.linePtr->segPtr;
1272 } else {
1268 if (linePtr == NULL) {
12731269 break;
12741270 }
1271
1272 dlPtr->logicalLinesMerged++;
1273 curIndex.byteIndex = 0;
1274 curIndex.linePtr = linePtr;
1275 segPtr = curIndex.linePtr->segPtr;
12751276 }
12761277 }
12771278
14581459
14591460 code = 1;
14601461 } else {
1461 code = (*segPtr->typePtr->layoutProc)(textPtr, &curIndex, segPtr,
1462 code = segPtr->typePtr->layoutProc(textPtr, &curIndex, segPtr,
14621463 byteOffset, maxX-tabSize, maxBytes, noCharsYet, wrapMode,
14631464 chunkPtr);
14641465 }
16101611 FreeStyle(textPtr, chunkPtr->stylePtr);
16111612 breakChunkPtr->nextPtr = chunkPtr->nextPtr;
16121613 if (chunkPtr->undisplayProc != NULL) {
1613 (*chunkPtr->undisplayProc)(textPtr, chunkPtr);
1614 chunkPtr->undisplayProc(textPtr, chunkPtr);
16141615 }
16151616 ckfree((char *) chunkPtr);
16161617 }
16171618 if (breakByteOffset != breakChunkPtr->numBytes) {
16181619 if (breakChunkPtr->undisplayProc != NULL) {
1619 (*breakChunkPtr->undisplayProc)(textPtr, breakChunkPtr);
1620 breakChunkPtr->undisplayProc(textPtr, breakChunkPtr);
16201621 }
16211622 segPtr = TkTextIndexToSeg(&breakIndex, &byteOffset);
1622 (*segPtr->typePtr->layoutProc)(textPtr, &breakIndex,
1623 segPtr, byteOffset, maxX, breakByteOffset, 0,
1624 wrapMode, breakChunkPtr);
1623 segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr,
1624 byteOffset, maxX, breakByteOffset, 0, wrapMode,
1625 breakChunkPtr);
16251626 #if TK_LAYOUT_WITH_BASE_CHUNKS
16261627 FinalizeBaseChunk(NULL);
16271628 #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
23052306 for (chunkPtr = firstPtr->chunkPtr; chunkPtr != NULL;
23062307 chunkPtr = nextChunkPtr) {
23072308 if (chunkPtr->undisplayProc != NULL) {
2308 (*chunkPtr->undisplayProc)(textPtr, chunkPtr);
2309 chunkPtr->undisplayProc(textPtr, chunkPtr);
23092310 }
23102311 FreeStyle(textPtr, chunkPtr->stylePtr);
23112312 nextChunkPtr = chunkPtr->nextPtr;
24032404 if (chunkPtr->displayProc == TkTextInsertDisplayProc) {
24042405 int x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curXPixelOffset;
24052406
2406 (*chunkPtr->displayProc)(textPtr, chunkPtr, x,
2407 chunkPtr->displayProc(textPtr, chunkPtr, x,
24072408 y + dlPtr->spaceAbove,
24082409 dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
24092410 dlPtr->baseline - dlPtr->spaceAbove, display, pixmap,
24512452
24522453 x = -chunkPtr->width;
24532454 }
2454 (*chunkPtr->displayProc)(textPtr, chunkPtr, x,
2455 chunkPtr->displayProc(textPtr, chunkPtr, x,
24552456 y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove -
24562457 dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove,
24572458 display, pixmap, dlPtr->y + dlPtr->spaceAbove);
27252726 rightX2 + xOffset, y, sValuePtr->borderWidth,
27262727 sValuePtr->borderWidth, 1, sValuePtr->relief);
27272728 Tk_3DHorizontalBevel(textPtr->tkwin, pixmap, sValuePtr->border,
2728 leftX + xOffset, y, rightX2 + sValuePtr->borderWidth -
2729 leftX + xOffset, y, rightX2 + sValuePtr->borderWidth -
27292730 leftX, sValuePtr->borderWidth, leftXIn, 0, 1,
27302731 sValuePtr->relief);
27312732 }
28772878 AsyncUpdateLineMetrics(
28782879 ClientData clientData) /* Information about widget. */
28792880 {
2880 register TkText *textPtr = (TkText *) clientData;
2881 register TkText *textPtr = clientData;
28812882 TextDInfo *dInfoPtr = textPtr->dInfoPtr;
28822883 int lineNum;
28832884
29472948 */
29482949
29492950 dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
2950 AsyncUpdateLineMetrics, (ClientData) textPtr);
2951 AsyncUpdateLineMetrics, textPtr);
29512952 }
29522953
29532954 /*
30483049 */
30493050
30503051 if (TkBTreeLinePixelEpoch(textPtr, linePtr)
3051 != textPtr->dInfoPtr->lineMetricUpdateEpoch) {
3052 if (doThisMuch == -1) {
3053 count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0,
3054 NULL, 0);
3055 } else {
3056 TkTextIndex index;
3057 TkTextIndex *indexPtr;
3058 int pixelHeight;
3059
3060 /*
3061 * If the metric epoch is the same as the widget's epoch,
3062 * then we know that indexPtrs are still valid, and if the
3063 * cached metricIndex (if any) is for the same line as we
3064 * wish to examine, then we are looking at a long line
3065 * wrapped many times, which we will examine in pieces.
3066 */
3067
3068 if (textPtr->dInfoPtr->metricEpoch ==
3069 textPtr->sharedTextPtr->stateEpoch &&
3070 textPtr->dInfoPtr->metricIndex.linePtr==linePtr) {
3071 indexPtr = &textPtr->dInfoPtr->metricIndex;
3072 pixelHeight = textPtr->dInfoPtr->metricPixelHeight;
3073 } else {
3074 /*
3075 * We must reset the partial line height calculation
3076 * data here, so we don't use it when it is out of
3077 * date.
3078 */
3079
3080 textPtr->dInfoPtr->metricEpoch = -1;
3081 index.tree = textPtr->sharedTextPtr->tree;
3082 index.linePtr = linePtr;
3083 index.byteIndex = 0;
3084 index.textPtr = NULL;
3085 indexPtr = &index;
3086 pixelHeight = 0;
3087 }
3088
3089 /*
3090 * Update the line and update the counter, counting 8 for
3091 * each display line we actually re-layout.
3092 */
3093
3094 count += 8 * TkTextUpdateOneLine(textPtr, linePtr,
3095 pixelHeight, indexPtr, 1);
3096
3097 if (indexPtr->linePtr == linePtr) {
3098 /*
3099 * We didn't complete the logical line, because it
3100 * produced very many display lines - it must be a
3101 * long line wrapped many times. So we must cache as
3102 * far as we got for next time around.
3103 */
3104
3105 if (pixelHeight == 0) {
3106 /*
3107 * These have already been stored, unless we just
3108 * started the new line.
3109 */
3110
3111 textPtr->dInfoPtr->metricIndex = index;
3112 textPtr->dInfoPtr->metricEpoch =
3113 textPtr->sharedTextPtr->stateEpoch;
3114 }
3115 textPtr->dInfoPtr->metricPixelHeight =
3116 TkBTreeLinePixelCount(textPtr, linePtr);
3117 break;
3118 } else {
3119 /*
3120 * We're done with this long line.
3121 */
3122
3123 textPtr->dInfoPtr->metricEpoch = -1;
3124 }
3125 }
3126 } else {
3052 == textPtr->dInfoPtr->lineMetricUpdateEpoch) {
31273053 /*
31283054 * This line is already up to date. That means there's nothing
31293055 * to do here.
31303056 */
3057 } else if (doThisMuch == -1) {
3058 count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0,NULL,0);
3059 } else {
3060 TkTextIndex index;
3061 TkTextIndex *indexPtr;
3062 int pixelHeight;
3063
3064 /*
3065 * If the metric epoch is the same as the widget's epoch, then
3066 * we know that indexPtrs are still valid, and if the cached
3067 * metricIndex (if any) is for the same line as we wish to
3068 * examine, then we are looking at a long line wrapped many
3069 * times, which we will examine in pieces.
3070 */
3071
3072 if (textPtr->dInfoPtr->metricEpoch ==
3073 textPtr->sharedTextPtr->stateEpoch &&
3074 textPtr->dInfoPtr->metricIndex.linePtr==linePtr) {
3075 indexPtr = &textPtr->dInfoPtr->metricIndex;
3076 pixelHeight = textPtr->dInfoPtr->metricPixelHeight;
3077 } else {
3078 /*
3079 * We must reset the partial line height calculation data
3080 * here, so we don't use it when it is out of date.
3081 */
3082
3083 textPtr->dInfoPtr->metricEpoch = -1;
3084 index.tree = textPtr->sharedTextPtr->tree;
3085 index.linePtr = linePtr;
3086 index.byteIndex = 0;
3087 index.textPtr = NULL;
3088 indexPtr = &index;
3089 pixelHeight = 0;
3090 }
3091
3092 /*
3093 * Update the line and update the counter, counting 8 for each
3094 * display line we actually re-layout.
3095 */
3096
3097 count += 8 * TkTextUpdateOneLine(textPtr, linePtr,
3098 pixelHeight, indexPtr, 1);
3099
3100 if (indexPtr->linePtr == linePtr) {
3101 /*
3102 * We didn't complete the logical line, because it
3103 * produced very many display lines, which must be because
3104 * it must be a long line wrapped many times. So we must
3105 * cache as far as we got for next time around.
3106 */
3107
3108 if (pixelHeight == 0) {
3109 /*
3110 * These have already been stored, unless we just
3111 * started the new line.
3112 */
3113
3114 textPtr->dInfoPtr->metricIndex = index;
3115 textPtr->dInfoPtr->metricEpoch =
3116 textPtr->sharedTextPtr->stateEpoch;
3117 }
3118 textPtr->dInfoPtr->metricPixelHeight =
3119 TkBTreeLinePixelCount(textPtr, linePtr);
3120 break;
3121 }
3122
3123 /*
3124 * We're done with this long line.
3125 */
3126
3127 textPtr->dInfoPtr->metricEpoch = -1;
31313128 }
31323129 } else {
31333130 /*
33283325 if (dInfoPtr->lineUpdateTimer == NULL) {
33293326 textPtr->refCount++;
33303327 dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
3331 AsyncUpdateLineMetrics, (ClientData) textPtr);
3328 AsyncUpdateLineMetrics, textPtr);
33323329 }
33333330 }
33343331
33783375 * of the original index within its display
33793376 * line. */
33803377 {
3378 TkTextIndex index;
3379
33813380 if (!end && indexPtr->byteIndex == 0) {
33823381 /*
33833382 * Nothing to do.
33873386 *xOffset = 0;
33883387 }
33893388 return;
3390 } else {
3391 TkTextIndex index = *indexPtr;
3392
3389 }
3390
3391 index = *indexPtr;
3392 index.byteIndex = 0;
3393 index.textPtr = NULL;
3394
3395 while (1) {
3396 TkTextIndex endOfLastLine;
3397
3398 if (TkTextIndexBackBytes(textPtr, &index, 1, &endOfLastLine)) {
3399 /*
3400 * Reached beginning of text.
3401 */
3402
3403 break;
3404 }
3405
3406 if (!TkTextIsElided(textPtr, &endOfLastLine, NULL)) {
3407 /*
3408 * The eol is not elided, so 'index' points to the start of a
3409 * display line (as well as logical line).
3410 */
3411
3412 break;
3413 }
3414
3415 /*
3416 * indexPtr's logical line is actually merged with the previous
3417 * logical line whose eol is elided. Continue searching back to get a
3418 * real line start.
3419 */
3420
3421 index = endOfLastLine;
33933422 index.byteIndex = 0;
3394 index.textPtr = NULL;
3395
3396 while (1) {
3397 TkTextIndex endOfLastLine;
3398
3399 if (TkTextIndexBackBytes(textPtr, &index, 1, &endOfLastLine)) {
3423 }
3424
3425 while (1) {
3426 DLine *dlPtr;
3427 int byteCount;
3428 TkTextIndex nextLineStart;
3429
3430 dlPtr = LayoutDLine(textPtr, &index);
3431 byteCount = dlPtr->byteCount;
3432
3433 TkTextIndexForwBytes(textPtr, &index, byteCount, &nextLineStart);
3434
3435 /*
3436 * 'byteCount' goes up to the beginning of the next display line, so
3437 * equality here says we need one more line. We try to perform a quick
3438 * comparison which is valid for the case where the logical line is
3439 * the same, but otherwise fall back on a full TkTextIndexCmp.
3440 */
3441
3442 if (((index.linePtr == indexPtr->linePtr)
3443 && (index.byteIndex + byteCount > indexPtr->byteIndex))
3444 || (dlPtr->logicalLinesMerged > 0
3445 && TkTextIndexCmp(&nextLineStart, indexPtr) > 0)) {
3446 /*
3447 * It's on this display line.
3448 */
3449
3450 if (xOffset != NULL) {
34003451 /*
3401 * Reached beginning of text.
3452 * This call takes a byte index relative to the start of the
3453 * current _display_ line, not logical line. We are about to
3454 * overwrite indexPtr->byteIndex, so we must do this now.
34023455 */
34033456
3404 break;
3405 }
3406
3407 if (!TkTextIsElided(textPtr, &endOfLastLine, NULL)) {
3457 *xOffset = DlineXOfIndex(textPtr, dlPtr,
3458 indexPtr->byteIndex - dlPtr->index.byteIndex);
3459 }
3460 if (end) {
34083461 /*
3409 * The eol is not elided, so 'index' points to the start of a
3410 * display line (as well as logical line).
3462 * The index we want is one less than the number of bytes in
3463 * the display line.
34113464 */
34123465
3413 break;
3414 }
3415
3416 /*
3417 * indexPtr's logical line is actually merged with the previous
3418 * logical line whose eol is elided. Continue searching back to
3419 * get a real line start.
3420 */
3421
3422 index = endOfLastLine;
3423 index.byteIndex = 0;
3424 }
3425
3426 while (1) {
3427 DLine *dlPtr;
3428 int byteCount;
3429 TkTextIndex nextLineStart;
3430
3431 dlPtr = LayoutDLine(textPtr, &index);
3432 byteCount = dlPtr->byteCount;
3433
3434 TkTextIndexForwBytes(textPtr, &index, byteCount, &nextLineStart);
3435
3436 /*
3437 * 'byteCount' goes up to the beginning of the next display line,
3438 * so equality here says we need one more line. We try to perform
3439 * a quick comparison which is valid for the case where the
3440 * logical line is the same, but otherwise fall back on a full
3441 * TkTextIndexCmp.
3442 */
3443
3444 if (((index.linePtr == indexPtr->linePtr)
3445 && (index.byteIndex + byteCount > indexPtr->byteIndex))
3446 || (dlPtr->logicalLinesMerged > 0
3447 && TkTextIndexCmp(&nextLineStart, indexPtr) > 0)) {
3448 /*
3449 * It's on this display line.
3450 */
3451
3452 if (xOffset != NULL) {
3453 /*
3454 * This call takes a byte index relative to the start of
3455 * the current _display_ line, not logical line. We are
3456 * about to overwrite indexPtr->byteIndex, so we must do
3457 * this now.
3458 */
3459
3460 *xOffset = DlineXOfIndex(textPtr, dlPtr,
3461 indexPtr->byteIndex - dlPtr->index.byteIndex);
3462 }
3463 if (end) {
3464 /*
3465 * The index we want is one less than the number of bytes
3466 * in the display line.
3467 */
3468
3469 TkTextIndexBackBytes(textPtr, &nextLineStart, 1, indexPtr);
3470 } else {
3471 *indexPtr = index;
3472 }
3473 FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
3474 return;
3466 TkTextIndexBackBytes(textPtr, &nextLineStart, 1, indexPtr);
3467 } else {
3468 *indexPtr = index;
34753469 }
34763470 FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
3477 index = nextLineStart;
3478 }
3471 return;
3472 }
3473
3474 FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
3475 index = nextLineStart;
34793476 }
34803477 }
34813478
38593856 if (textPtr->dInfoPtr->scrollbarTimer == NULL) {
38603857 textPtr->refCount++;
38613858 textPtr->dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200,
3862 AsyncUpdateYScrollbar, (ClientData) textPtr);
3859 AsyncUpdateYScrollbar, textPtr);
38633860 }
38643861 return displayLines;
38653862 }
38853882 DisplayText(
38863883 ClientData clientData) /* Information about widget. */
38873884 {
3888 register TkText *textPtr = (TkText *) clientData;
3885 register TkText *textPtr = clientData;
38893886 TextDInfo *dInfoPtr = textPtr->dInfoPtr;
38903887 register DLine *dlPtr;
38913888 DLine *prevPtr;
39043901 }
39053902
39063903 interp = textPtr->interp;
3907 Tcl_Preserve((ClientData) interp);
3904 Tcl_Preserve(interp);
39083905
39093906 if (tkTextDebug) {
39103907 Tcl_SetVar2(interp, "tk_textRelayout", NULL, "", TCL_GLOBAL_ONLY);
43424339 }
43434340
43444341 end:
4345 Tcl_Release((ClientData) interp);
4342 Tcl_Release(interp);
43464343 }
43474344
43484345 /*
43714368 dInfoPtr->flags |= REPICK_NEEDED;
43724369 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
43734370 dInfoPtr->flags |= REDRAW_PENDING;
4374 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
4371 Tcl_DoWhenIdle(DisplayText, textPtr);
43754372 }
43764373 }
43774374
44154412
44164413 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
44174414 dInfoPtr->flags |= REDRAW_PENDING;
4418 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
4415 Tcl_DoWhenIdle(DisplayText, textPtr);
44194416 }
44204417 TkDestroyRegion(damageRgn);
44214418 }
45524549 */
45534550
45544551 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
4555 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
4552 Tcl_DoWhenIdle(DisplayText, textPtr);
45564553 }
45574554 dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
45584555
47344731 */
47354732
47364733 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
4737 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
4734 Tcl_DoWhenIdle(DisplayText, textPtr);
47384735 }
47394736 dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
47404737
48394836 */
48404837
48414838 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
4842 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
4839 Tcl_DoWhenIdle(DisplayText, textPtr);
48434840 }
48444841 dInfoPtr->flags |= REDRAW_PENDING|REDRAW_BORDERS|DINFO_OUT_OF_DATE
48454842 |REPICK_NEEDED;
49344931 if (dInfoPtr->lineUpdateTimer == NULL) {
49354932 textPtr->refCount++;
49364933 dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
4937 AsyncUpdateLineMetrics, (ClientData) textPtr);
4934 AsyncUpdateLineMetrics, textPtr);
49384935 }
49394936 }
49404937 }
51185115
51195116 scheduleUpdate:
51205117 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
5121 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
5118 Tcl_DoWhenIdle(DisplayText, textPtr);
51225119 }
51235120 dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
51245121 }
53845381 */
53855382
53865383 if (chunkPtr != NULL) {
5387 (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteCount,
5384 chunkPtr->bboxProc(textPtr, chunkPtr, byteCount,
53885385 dlPtr->y + dlPtr->spaceAbove,
53895386 dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
53905387 dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width,
53985395 dInfoPtr->newXPixelOffset -= ((-delta) );
53995396 }
54005397 } else {
5401 delta -= (lineWidth - width);
5402 if (delta > 0) {
5403 if (delta > oneThird) {
5404 dInfoPtr->newXPixelOffset = (x - lineWidth/2);
5405 } else {
5406 dInfoPtr->newXPixelOffset += (delta );
5407 }
5398 delta -= lineWidth - width;
5399 if (delta <= 0) {
5400 return TCL_OK;
5401 } else if (delta > oneThird) {
5402 dInfoPtr->newXPixelOffset = (x - lineWidth/2);
54085403 } else {
5409 return TCL_OK;
5404 dInfoPtr->newXPixelOffset += (delta );
54105405 }
54115406 }
54125407 }
54135408 dInfoPtr->flags |= DINFO_OUT_OF_DATE;
54145409 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
54155410 dInfoPtr->flags |= REDRAW_PENDING;
5416 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
5411 Tcl_DoWhenIdle(DisplayText, textPtr);
54175412 }
54185413 return TCL_OK;
54195414 }
54945489 dInfoPtr->flags |= DINFO_OUT_OF_DATE;
54955490 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
54965491 dInfoPtr->flags |= REDRAW_PENDING;
5497 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
5492 Tcl_DoWhenIdle(DisplayText, textPtr);
54985493 }
54995494 return TCL_OK;
55005495 }
55795574 return;
55805575 }
55815576 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
5582 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
5577 Tcl_DoWhenIdle(DisplayText, textPtr);
55835578 }
55845579 dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
55855580 }
56965691
56975692 scheduleUpdate:
56985693 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
5699 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
5694 Tcl_DoWhenIdle(DisplayText, textPtr);
57005695 }
57015696 dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
57025697 }
59765971 dInfoPtr->flags |= DINFO_OUT_OF_DATE;
59775972 if (!(dInfoPtr->flags & REDRAW_PENDING)) {
59785973 dInfoPtr->flags |= REDRAW_PENDING;
5979 Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
5974 Tcl_DoWhenIdle(DisplayText, textPtr);
59805975 }
59815976 } else if (c=='m' && strncmp(Tcl_GetString(objv[2]), "mark", length)==0) {
59825977 dInfoPtr->scanMarkXPixel = dInfoPtr->newXPixelOffset;
60676062 if (code != TCL_OK) {
60686063 Tcl_AddErrorInfo(interp,
60696064 "\n (horizontal scrolling command executed by text)");
6070 Tcl_BackgroundError(interp);
6065 Tcl_BackgroundException(interp, code);
60716066 }
60726067 }
60736068 }
61896184 notFirst = 1;
61906185 }
61916186 break;
6192 } else {
6193 dlPtr = dlPtr->nextPtr;
6194 }
6187 }
6188 dlPtr = dlPtr->nextPtr;
61956189 } while (dlPtr->index.linePtr == linePtr);
61966190
61976191 return count;
63506344 if (code != TCL_OK) {
63516345 Tcl_AddErrorInfo(interp,
63526346 "\n (vertical scrolling command executed by text)");
6353 Tcl_BackgroundError(interp);
6347 Tcl_BackgroundException(interp, code);
63546348 }
63556349 }
63566350 }
63776371 AsyncUpdateYScrollbar(
63786372 ClientData clientData) /* Information about widget. */
63796373 {
6380 register TkText *textPtr = (TkText *) clientData;
6374 register TkText *textPtr = clientData;
63816375
63826376 textPtr->dInfoPtr->scrollbarTimer = NULL;
63836377
65426536 }
65436537 *indexPtr = textPtr->topIndex;
65446538 return;
6545 } else {
6546 for (dlPtr = validDlPtr = dInfoPtr->dLinePtr;
6547 y >= (dlPtr->y + dlPtr->height);
6548 dlPtr = dlPtr->nextPtr) {
6549 if (dlPtr->chunkPtr != NULL) {
6550 validDlPtr = dlPtr;
6551 }
6552 if (dlPtr->nextPtr == NULL) {
6553 /*
6554 * Y-coordinate is off the bottom of the displayed text. Use
6555 * the last character on the last line.
6556 */
6557
6558 x = dInfoPtr->maxX - 1;
6559 nearby = 1;
6560 break;
6561 }
6562 }
6563 if (dlPtr->chunkPtr == NULL) dlPtr = validDlPtr;
6539 }
6540 for (dlPtr = validDlPtr = dInfoPtr->dLinePtr;
6541 y >= (dlPtr->y + dlPtr->height);
6542 dlPtr = dlPtr->nextPtr) {
6543 if (dlPtr->chunkPtr != NULL) {
6544 validDlPtr = dlPtr;
6545 }
6546 if (dlPtr->nextPtr == NULL) {
6547 /*
6548 * Y-coordinate is off the bottom of the displayed text. Use the
6549 * last character on the last line.
6550 */
6551
6552 x = dInfoPtr->maxX - 1;
6553 nearby = 1;
6554 break;
6555 }
6556 }
6557 if (dlPtr->chunkPtr == NULL) {
6558 dlPtr = validDlPtr;
65646559 }
65656560
65666561 if (nearest != NULL) {
66536648 */
66546649
66556650 if (chunkPtr->numBytes > 1) {
6656 indexPtr->byteIndex += (*chunkPtr->measureProc)(chunkPtr, x);
6651 indexPtr->byteIndex += chunkPtr->measureProc(chunkPtr, x);
66576652 }
66586653 }
66596654
67416736 if (byteIndex < chunkPtr->numBytes) {
67426737 int y, width, height;
67436738
6744 (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteIndex,
6739 chunkPtr->bboxProc(textPtr, chunkPtr, byteIndex,
67456740 dlPtr->y + dlPtr->spaceAbove,
67466741 dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
67476742 dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width,
67486743 &height);
67496744 break;
6750 } else {
6751 byteIndex -= chunkPtr->numBytes;
6752 }
6745 }
6746 byteIndex -= chunkPtr->numBytes;
67536747 if (chunkPtr->nextPtr == NULL || byteIndex == 0) {
67546748 x = chunkPtr->x + chunkPtr->width;
67556749 break;
68376831 * coordinate on the screen. Translate it to reflect horizontal scrolling.
68386832 */
68396833
6840 (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteIndex,
6834 chunkPtr->bboxProc(textPtr, chunkPtr, byteIndex,
68416835 dlPtr->y + dlPtr->spaceAbove,
68426836 dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
68436837 dlPtr->baseline - dlPtr->spaceAbove, xPtr, yPtr, widthPtr,
70787072
70797073 ciPtr = &bciPtr->ci;
70807074 } else {
7081 bciPtr = (BaseCharInfo *) baseCharChunkPtr->clientData;
7075 bciPtr = baseCharChunkPtr->clientData;
70827076 ciPtr = (CharInfo *) ckalloc(sizeof(CharInfo));
70837077 baseString = &bciPtr->baseChars;
70847078 }
70867080 lineOffset = Tcl_DStringLength(baseString);
70877081 line = Tcl_DStringAppend(baseString,p,maxBytes);
70887082
7089 chunkPtr->clientData = (ClientData) ciPtr;
7083 chunkPtr->clientData = ciPtr;
70907084 ciPtr->baseChunkPtr = baseCharChunkPtr;
70917085 ciPtr->baseOffset = lineOffset;
70927086 ciPtr->chars = NULL;
71707164 #if !TK_LAYOUT_WITH_BASE_CHUNKS
71717165 ciPtr = (CharInfo *)
71727166 ckalloc((unsigned) bytesThatFit + Tk_Offset(CharInfo, chars) + 1);
7173 chunkPtr->clientData = (ClientData) ciPtr;
7167 chunkPtr->clientData = ciPtr;
71747168 memcpy(ciPtr->chars, p, (unsigned) bytesThatFit);
71757169 #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
71767170
72727266 * here. */
72737267 {
72747268 Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
7275 CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
7269 CharInfo *ciPtr = chunkPtr->clientData;
72767270
72777271 #if !TK_LAYOUT_WITH_BASE_CHUNKS
72787272 if (chars == NULL) {
73617355 int screenY) /* Y-coordinate in text window that
73627356 * corresponds to y. */
73637357 {
7364 CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
7358 CharInfo *ciPtr = chunkPtr->clientData;
73657359 const char *string;
73667360 TextStyle *stylePtr;
73677361 StyleValues *sValuePtr;
73797373 }
73807374
73817375 #if TK_DRAW_IN_CONTEXT
7382 bciPtr = (BaseCharInfo *) ciPtr->baseChunkPtr->clientData;
7376 bciPtr = ciPtr->baseChunkPtr->clientData;
73837377 numBytes = Tcl_DStringLength(&bciPtr->baseChars);
73847378 string = Tcl_DStringValue(&bciPtr->baseChars);
73857379
75127506 TkText *textPtr, /* Overall information about text widget. */
75137507 TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
75147508 {
7515 CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
7509 CharInfo *ciPtr = chunkPtr->clientData;
75167510
75177511 if (ciPtr) {
75187512 #if TK_LAYOUT_WITH_BASE_CHUNKS
76157609 int *heightPtr) /* Gets filled in with height of character, in
76167610 * pixels. */
76177611 {
7618 CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
7612 CharInfo *ciPtr = chunkPtr->clientData;
76197613 int maxX;
76207614
76217615 maxX = chunkPtr->width + chunkPtr->x;
77787772 if (chunkPtr2->displayProc != CharDisplayProc) {
77797773 continue;
77807774 }
7781 ciPtr = (CharInfo *) chunkPtr2->clientData;
7775 ciPtr = chunkPtr2->clientData;
77827776 for (p = ciPtr->chars, i = 0; i < ciPtr->numBytes; p++, i++) {
77837777 if (isdigit(UCHAR(*p))) {
77847778 gotDigit = 1;
77997793 if (decimalChunkPtr != NULL) {
78007794 int curX;
78017795
7802 ciPtr = (CharInfo *) decimalChunkPtr->clientData;
7796 ciPtr = decimalChunkPtr->clientData;
78037797 CharChunkMeasureChars(decimalChunkPtr, NULL, 0, 0, decimal,
78047798 decimalChunkPtr->x, -1, 0, &curX);
78057799 desired = tabX - (curX - x);
78067800 goto update;
7807 } else {
7808 /*
7809 * There wasn't a decimal point. Right justify the text.
7810 */
7811
7812 width = 0;
7813 for (chunkPtr2 = chunkPtr->nextPtr; chunkPtr2 != NULL;
7814 chunkPtr2 = chunkPtr2->nextPtr) {
7815 width += chunkPtr2->width;
7816 }
7817 desired = tabX - width;
7818 }
7801 }
7802
7803 /*
7804 * There wasn't a decimal point. Right justify the text.
7805 */
7806
7807 width = 0;
7808 for (chunkPtr2 = chunkPtr->nextPtr; chunkPtr2 != NULL;
7809 chunkPtr2 = chunkPtr2->nextPtr) {
7810 width += chunkPtr2->width;
7811 }
7812 desired = tabX - width;
78197813
78207814 /*
78217815 * Shift all of the chunks to the right so that the left edge is at the
81158109 break;
81168110 }
81178111 if (special < end) {
8118 if (ch == '\t') {
8119 start++;
8120 } else {
8112 if (ch != '\t') {
81218113 break;
81228114 }
8115 start++;
81238116 }
81248117 }
81258118
81668159 int *intPtr) /* Filled in with number of pages or lines or
81678160 * pixels to scroll, if any. */
81688161 {
8169 static const char *subcommands[] = {
8162 static const char *const subcommands[] = {
81708163 "moveto", "scroll", NULL
81718164 };
81728165 enum viewSubcmds {
81738166 VIEW_MOVETO, VIEW_SCROLL
81748167 };
8175 static const char *units[] = {
8168 static const char *const units[] = {
81768169 "units", "pages", "pixels", NULL
81778170 };
81788171 enum viewUnits {
82798272 if (chunkPtr->displayProc != CharDisplayProc) {
82808273 continue;
82818274 }
8282 ciPtr = (CharInfo *)chunkPtr->clientData;
8275 ciPtr = chunkPtr->clientData;
82838276 if (ciPtr->baseChunkPtr != baseCharChunkPtr) {
82848277 break;
82858278 }
82968289 }
82978290
82988291 if (addChunkPtr != NULL) {
8299 ciPtr = (CharInfo *)addChunkPtr->clientData;
8292 ciPtr = addChunkPtr->clientData;
83008293 ciPtr->chars = baseChars + ciPtr->baseOffset;
83018294
83028295 #if TK_DRAW_IN_CONTEXT
83478340 if (chunkPtr->undisplayProc != CharUndisplayProc) {
83488341 continue;
83498342 }
8350 ciPtr = (CharInfo *) chunkPtr->clientData;
8343 ciPtr = chunkPtr->clientData;
83518344 if (ciPtr->baseChunkPtr != baseChunkPtr) {
83528345 break;
83538346 }
84658458 * Reinstitute this base chunk for re-layout.
84668459 */
84678460
8468 ciPtr = (CharInfo *) chunkPtr->clientData;
8461 ciPtr = chunkPtr->clientData;
84698462 baseCharChunkPtr = ciPtr->baseChunkPtr;
84708463
84718464 /*
84728465 * Remove the chunk data from the base chunk data.
84738466 */
84748467
8475 bciPtr = (BaseCharInfo *) baseCharChunkPtr->clientData;
8468 bciPtr = baseCharChunkPtr->clientData;
84768469
84778470 if ((ciPtr->baseOffset + ciPtr->numBytes)
84788471 != Tcl_DStringLength(&bciPtr->baseChars)) {
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkTextImage.c,v 1.23 2008/07/23 23:24:23 nijtmans Exp $
11 * RCS: @(#) $Id: tkTextImage.c,v 1.25 2008/10/30 23:18:59 nijtmans Exp $
1212 */
1313
1414 #include "tkPort.h"
7070 * Definitions for alignment values:
7171 */
7272
73 static char *alignStrings[] = {
73 static const char *const alignStrings[] = {
7474 "baseline", "bottom", "center", "top", NULL
7575 };
7676
9999 {TK_OPTION_END}
100100 };
101101
102
102
103103 /*
104104 *--------------------------------------------------------------
105105 *
129129 int idx;
130130 register TkTextSegment *eiPtr;
131131 TkTextIndex index;
132 static const char *optionStrings[] = {
132 static const char *const optionStrings[] = {
133133 "cget", "configure", "create", "names", NULL
134134 };
135135 enum opts {
291291 }
292292 return TCL_ERROR;
293293 }
294
294
295295 /*
296296 *--------------------------------------------------------------
297297 *
419419
420420 return TCL_OK;
421421 }
422
422
423423 /*
424424 *--------------------------------------------------------------
425425 *
474474 ckfree((char *) eiPtr);
475475 return 0;
476476 }
477
477
478478 /*
479479 *--------------------------------------------------------------
480480 *
500500 eiPtr->body.ei.linePtr = linePtr;
501501 return eiPtr;
502502 }
503
503
504504 /*
505505 *--------------------------------------------------------------
506506 *
588588 eiPtr->body.ei.chunkCount += 1;
589589 return 1;
590590 }
591
591
592592 /*
593593 *--------------------------------------------------------------
594594 *
620620 eiPtr->size);
621621 }
622622 }
623
623
624624 /*
625625 *--------------------------------------------------------------
626626 *
679679
680680 Tk_RedrawImage(image, 0, 0, width, height, dst, imageX, imageY);
681681 }
682
682
683683 /*
684684 *--------------------------------------------------------------
685685 *
748748 break;
749749 }
750750 }
751
751
752752 /*
753753 *--------------------------------------------------------------
754754 *
787787 indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr);
788788 return 1;
789789 }
790
790
791791 /*
792792 *--------------------------------------------------------------
793793 *
832832 TkTextInvalidateLineMetrics(eiPtr->body.ei.sharedTextPtr, NULL,
833833 index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
834834 }
835
835
836836 /*
837837 * Local Variables:
838838 * mode: c
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkTextIndex.c,v 1.30 2008/10/05 18:22:22 dkf Exp $
12 * RCS: @(#) $Id: tkTextIndex.c,v 1.34 2008/12/05 15:51:31 nijtmans Exp $
1313 */
1414
1515 #include "default.h"
7171 * text widgets internally.
7272 */
7373
74 Tcl_ObjType tkTextIndexType = {
74 const Tcl_ObjType tkTextIndexType = {
7575 "textindex", /* name */
7676 FreeTextIndexInternalRep, /* freeIntRepProc */
7777 DupTextIndexInternalRep, /* dupIntRepProc */
7878 NULL, /* updateStringProc */
7979 SetTextIndexFromAny /* setFromAnyProc */
8080 };
81
81
8282 static void
8383 FreeTextIndexInternalRep(
8484 Tcl_Obj *indexObjPtr) /* TextIndex object with internal rep to
148148 "via TkTextGetIndexFromObj API", -1);
149149 return TCL_ERROR;
150150 }
151
151
152152 /*
153153 *---------------------------------------------------------------------------
154154 *
198198 }
199199 return indexPtr;
200200 }
201
201
202202 const TkTextIndex *
203203 TkTextGetIndexFromObj(
204204 Tcl_Interp *interp, /* Use this for error reporting. */
238238 if (objPtr->bytes == NULL) {
239239 objPtr->typePtr->updateStringProc(objPtr);
240240 }
241 if ((objPtr->typePtr->freeIntRepProc) != NULL) {
242 (*objPtr->typePtr->freeIntRepProc)(objPtr);
241 if (objPtr->typePtr->freeIntRepProc != NULL) {
242 objPtr->typePtr->freeIntRepProc(objPtr);
243243 }
244244 }
245245
246246 return MakeObjIndex((cache ? textPtr : NULL), objPtr, &index);
247247 }
248
248
249249 /*
250250 *---------------------------------------------------------------------------
251251 *
290290 UpdateStringOfTextIndex(retVal);
291291 return retVal;
292292 }
293
293
294294 /*
295295 *---------------------------------------------------------------------------
296296 *
358358 }
359359 return TkTextMeasureDown(textPtr, indexPtr, pixelOffset);
360360 }
361
361
362362 /*
363363 *---------------------------------------------------------------------------
364364 *
381381
382382 TkTextIndex *
383383 TkTextMakeByteIndex(
384 TkTextBTree tree, /* Tree that lineIndex and byteIndex refer
384 TkTextBTree tree, /* Tree that lineIndex and byteIndex refer
385385 * to. */
386386 const TkText *textPtr,
387387 int lineIndex, /* Index of desired line (0 means first line
451451 }
452452 return indexPtr;
453453 }
454
454
455455 /*
456456 *---------------------------------------------------------------------------
457457 *
546546 }
547547 return indexPtr;
548548 }
549
549
550550 /*
551551 *---------------------------------------------------------------------------
552552 *
586586 }
587587 return segPtr;
588588 }
589
589
590590 /*
591591 *---------------------------------------------------------------------------
592592 *
619619 }
620620 return offset;
621621 }
622
622
623623 /*
624624 *---------------------------------------------------------------------------
625625 *
648648 return GetIndex(interp, NULL, textPtr, Tcl_GetString(idxObj), indexPtr,
649649 NULL);
650650 }
651
651
652652 /*
653653 *---------------------------------------------------------------------------
654654 *
677677 return GetIndex(interp, sharedTextPtr, NULL, Tcl_GetString(idxObj),
678678 indexPtr, NULL);
679679 }
680
680
681681 /*
682682 *---------------------------------------------------------------------------
683683 *
706706 {
707707 return GetIndex(interp, NULL, textPtr, string, indexPtr, NULL);
708708 }
709
709
710710 /*
711711 *---------------------------------------------------------------------------
712712 *
999999 Tcl_AppendResult(interp, "bad text index \"", string, "\"", NULL);
10001000 return TCL_ERROR;
10011001 }
1002
1002
10031003 /*
10041004 *---------------------------------------------------------------------------
10051005 *
10631063 return sprintf(string, "%d.%d",
10641064 TkBTreeLinesTo(textPtr, indexPtr->linePtr) + 1, charIndex);
10651065 }
1066
1066
10671067 /*
10681068 *---------------------------------------------------------------------------
10691069 *
11161116 }
11171117 return 0;
11181118 }
1119
1119
11201120 /*
11211121 *---------------------------------------------------------------------------
11221122 *
13601360 }
13611361 return p;
13621362 }
1363
1363
13641364 /*
13651365 *---------------------------------------------------------------------------
13661366 *
14301430 dstPtr->linePtr = linePtr;
14311431 }
14321432 }
1433
1433
14341434 /*
14351435 *---------------------------------------------------------------------------
14361436 *
16091609 ckfree((char *) infoPtr);
16101610 }
16111611 }
1612
1612
16131613 /*
16141614 *---------------------------------------------------------------------------
16151615 *
18741874 }
18751875 return 0;
18761876 }
1877
1877
18781878 /*
18791879 *---------------------------------------------------------------------------
18801880 *
20892089 ckfree((char *) infoPtr);
20902090 }
20912091 }
2092
2092
20932093 /*
20942094 *----------------------------------------------------------------------
20952095 *
22932293 done:
22942294 return p;
22952295 }
2296
2296
22972297 /*
22982298 * Local Variables:
22992299 * mode: c
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkTextMark.c,v 1.21 2008/07/23 23:24:23 nijtmans Exp $
12 * RCS: @(#) $Id: tkTextMark.c,v 1.23 2008/12/06 10:48:29 dkf Exp $
1313 */
1414
1515 #include "tkInt.h"
1616 #include "tkText.h"
17 #include "tk3d.h"
1718
1819 /*
1920 * Macro that determines the size of a mark segment:
105106 TkTextIndex index;
106107 const Tk_SegType *newTypePtr;
107108 int optionIndex;
108 static const char *markOptionStrings[] = {
109 static const char *const markOptionStrings[] = {
109110 "gravity", "names", "next", "previous", "set", "unset", NULL
110111 };
111112 enum markOptions {
144145 Tcl_GetString(objv[3]), "\"", NULL);
145146 return TCL_ERROR;
146147 }
147 markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
148 markPtr = Tcl_GetHashValue(hPtr);
148149 }
149150 if (objc == 4) {
150151 if (markPtr->typePtr == &tkTextRightMarkType) {
156157 }
157158 str = Tcl_GetStringFromObj(objv[4],&length);
158159 c = str[0];
159 if ((c == 'l') && (strncmp(str, "left", (unsigned)length) == 0)) {
160 if ((c == 'l') && (strncmp(str, "left", (unsigned) length) == 0)) {
160161 newTypePtr = &tkTextLeftMarkType;
161162 } else if ((c == 'r') &&
162 (strncmp(str, "right", (unsigned)length) == 0)) {
163 (strncmp(str, "right", (unsigned) length) == 0)) {
163164 newTypePtr = &tkTextRightMarkType;
164165 } else {
165166 Tcl_AppendResult(interp, "bad mark gravity \"", str,
214215 hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable,
215216 Tcl_GetString(objv[i]));
216217 if (hPtr != NULL) {
217 markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
218 markPtr = Tcl_GetHashValue(hPtr);
218219
219220 /*
220221 * Special case not needed with peer widgets.
275276 widgetSpecific = 0;
276277 hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name,
277278 &isNew);
278 markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
279 markPtr = Tcl_GetHashValue(hPtr);
279280 }
280281 if (!isNew) {
281282 /*
288289 TkTextIndex index, index2;
289290
290291 TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
291 TkTextIndexForwChars(NULL,&index, 1, &index2, COUNT_INDICES);
292 TkTextIndexForwChars(NULL, &index, 1, &index2, COUNT_INDICES);
292293
293294 /*
294295 * While we wish to redisplay, no heights have changed, so no need
297298
298299 TkTextChanged(NULL, textPtr, &index, &index2);
299300 if (TkBTreeLinesTo(textPtr, indexPtr->linePtr) ==
300 TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr)) {
301 TkTextIndexBackChars(NULL,indexPtr, 1, &insertIndex,
301 TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr)) {
302 TkTextIndexBackChars(NULL, indexPtr, 1, &insertIndex,
302303 COUNT_INDICES);
303304 indexPtr = &insertIndex;
304305 }
329330 if (markPtr == textPtr->insertMarkPtr) {
330331 TkTextIndex index2;
331332
332 TkTextIndexForwChars(NULL,indexPtr, 1, &index2, COUNT_INDICES);
333 TkTextIndexForwChars(NULL, indexPtr, 1, &index2, COUNT_INDICES);
333334
334335 /*
335336 * While we wish to redisplay, no heights have changed, so no need to
413414 } else if (!strcmp(name, "current")) {
414415 segPtr = textPtr->currentMarkPtr;
415416 } else {
416 Tcl_HashEntry *hPtr;
417 hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, name);
417 Tcl_HashEntry *hPtr =
418 Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, name);
419
418420 if (hPtr == NULL) {
419421 return TCL_ERROR;
420422 }
421 segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
423 segPtr = Tcl_GetHashValue(hPtr);
422424 }
423425 TkTextMarkSegToIndex(textPtr, segPtr, indexPtr);
424426 return TCL_OK;
585587 int rightSideWidth;
586588 int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0;
587589
588 if(textPtr->insertCursorType) {
590 if (textPtr->insertCursorType) {
589591 TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
590592 TkTextIndexBbox(textPtr, &index, &ix, &iy, &iw, &ih, &charWidth);
591593 rightSideWidth = charWidth + halfWidth;
613615 * the cursor.
614616 */
615617
616 if (textPtr->flags & INSERT_ON) {
618 if (textPtr->flags & GOT_FOCUS) {
619 if (textPtr->flags & INSERT_ON) {
620 Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder,
621 x - halfWidth, y, charWidth + textPtr->insertWidth,
622 height, textPtr->insertBorderWidth, TK_RELIEF_RAISED);
623 } else if (textPtr->selBorder == textPtr->insertBorder) {
624 Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->border,
625 x - halfWidth, y, charWidth + textPtr->insertWidth,
626 height, 0, TK_RELIEF_FLAT);
627 }
628 } else if (textPtr->insertUnfocussed == TK_TEXT_INSERT_NOFOCUS_HOLLOW) {
629 if (textPtr->insertBorderWidth < 1) {
630 /*
631 * Hack to work around the fact that a "solid" border always
632 * paints in black.
633 */
634
635 TkBorder *borderPtr = (TkBorder *) textPtr->insertBorder;
636
637 XDrawRectangle(Tk_Display(textPtr->tkwin), dst, borderPtr->bgGC,
638 x - halfWidth, y, charWidth + textPtr->insertWidth - 1,
639 height - 1);
640 } else {
641 Tk_Draw3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder,
642 x - halfWidth, y, charWidth + textPtr->insertWidth,
643 height, textPtr->insertBorderWidth, TK_RELIEF_RAISED);
644 }
645 } else if (textPtr->insertUnfocussed == TK_TEXT_INSERT_NOFOCUS_SOLID) {
617646 Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder,
618647 x - halfWidth, y, charWidth + textPtr->insertWidth, height,
619648 textPtr->insertBorderWidth, TK_RELIEF_RAISED);
620 } else if (textPtr->selBorder == textPtr->insertBorder) {
621 Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->border,
622 x - halfWidth, y, charWidth + textPtr->insertWidth, height,
623 0, TK_RELIEF_FLAT);
624649 }
625650 }
626651
749774 * position.
750775 */
751776
752 segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
777 segPtr = Tcl_GetHashValue(hPtr);
753778 TkTextMarkSegToIndex(textPtr, segPtr, &index);
754779 segPtr = segPtr->nextPtr;
755780 } else {
847872 * position.
848873 */
849874
850 segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
875 segPtr = Tcl_GetHashValue(hPtr);
851876 TkTextMarkSegToIndex(textPtr, segPtr, &index);
852877 } else {
853878 /*
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkTextTag.c,v 1.29 2008/07/23 23:24:23 nijtmans Exp $
13 * RCS: @(#) $Id: tkTextTag.c,v 1.30 2008/10/17 23:18:37 nijtmans Exp $
1414 */
1515
1616 #include "default.h"
2424 * a whole is not.
2525 */
2626
27 static char *wrapStrings[] = {
27 static const char *const wrapStrings[] = {
2828 "char", "none", "word", "", NULL
2929 };
3030
3535 * widget as a whole is not.
3636 */
3737
38 static char *tabStyleStrings[] = {
38 static const char *const tabStyleStrings[] = {
3939 "tabular", "wordprocessor", "", NULL
4040 };
4141
131131 * parsed this command enough to know that
132132 * objv[1] is "tag". */
133133 {
134 static const char *tagOptionStrings[] = {
134 static const char *const tagOptionStrings[] = {
135135 "add", "bind", "cget", "configure", "delete", "lower", "names",
136136 "nextrange", "prevrange", "raise", "ranges", "remove", NULL
137137 };
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkTextWind.c,v 1.24 2008/07/23 23:24:23 nijtmans Exp $
13 * RCS: @(#) $Id: tkTextWind.c,v 1.26 2008/12/09 21:22:56 dgp Exp $
1414 */
1515
1616 #include "tkPort.h"
8686 * Definitions for alignment values:
8787 */
8888
89 static char *alignStrings[] = {
89 static const char *const alignStrings[] = {
9090 "baseline", "bottom", "center", "top", NULL
9191 };
9292
142142 * objv[1] is "window". */
143143 {
144144 int optionIndex;
145 static const char *windOptionStrings[] = {
145 static const char *const windOptionStrings[] = {
146146 "cget", "configure", "create", "names", NULL
147147 };
148148 enum windOptions {
910910 }
911911 if (code != TCL_OK) {
912912 createError:
913 Tcl_BackgroundError(textPtr->interp);
913 Tcl_BackgroundException(textPtr->interp, code);
914914 goto gotWindow;
915915 }
916916 Tcl_DStringInit(&name);
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkTrig.c,v 1.10 2007/12/13 15:24:21 dgp Exp $
13 * RCS: @(#) $Id: tkTrig.c,v 1.11 2008/11/22 22:28:52 das Exp $
1414 */
1515
1616 #include <stdio.h>
2121 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
2222 #undef MAX
2323 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
24 #ifndef PI
25 # define PI 3.14159265358979323846
26 #endif /* PI */
2724
2825 /*
2926 *--------------------------------------------------------------
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkUndo.c,v 1.13 2007/12/13 15:24:21 dgp Exp $
11 * RCS: @(#) $Id: tkUndo.c,v 1.14 2008/11/08 18:44:40 dkf Exp $
1212 */
1313
1414 #include "tkInt.h"
655655
656656 while (action != NULL) {
657657 if (action->funcPtr != NULL) {
658 result = (*action->funcPtr)(interp, action->clientData,
658 result = action->funcPtr(interp, action->clientData,
659659 action->action);
660660 } else if (action->command != NULL) {
661661 Tcl_Obj *cmdNameObj, *evalObj;
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkUtil.c,v 1.21 2007/12/13 15:24:21 dgp Exp $
12 * RCS: @(#) $Id: tkUtil.c,v 1.27 2008/12/10 05:02:51 das Exp $
1313 */
1414
1515 #include "tkInt.h"
1919 * object, used for quickly finding a mapping in a TkStateMap.
2020 */
2121
22 Tcl_ObjType tkStateKeyObjType = {
22 const Tcl_ObjType tkStateKeyObjType = {
2323 "statekey", /* name */
2424 NULL, /* freeIntRepProc */
2525 NULL, /* dupIntRepProc */
122122 *--------------------------------------------------------------
123123 */
124124
125 char *
125 const char *
126126 TkStatePrintProc(
127127 ClientData clientData, /* Ignored. */
128128 Tk_Window tkwin, /* Window containing canvas widget. */
223223 *--------------------------------------------------------------
224224 */
225225
226 char *
226 const char *
227227 TkOrientPrintProc(
228228 ClientData clientData, /* Ignored. */
229229 Tk_Window tkwin, /* Window containing canvas widget. */
395395 *----------------------------------------------------------------------
396396 */
397397
398 char *
398 const char *
399399 TkOffsetPrintProc(
400400 ClientData clientData, /* not used */
401401 Tk_Window tkwin, /* not used */
494494 *----------------------------------------------------------------------
495495 */
496496
497 char *
497 const char *
498498 TkPixelPrintProc(
499499 ClientData clientData, /* not used */
500500 Tk_Window tkwin, /* not used */
949949 if (strcmp(key, mPtr->strKey) == 0) {
950950 typePtr = keyPtr->typePtr;
951951 if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
952 (*typePtr->freeIntRepProc)(keyPtr);
952 typePtr->freeIntRepProc(keyPtr);
953953 }
954954 keyPtr->internalRep.twoPtrValue.ptr1 = (void *) mapPtr;
955955 keyPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(mPtr->numKey);
977977 }
978978
979979 /*
980 * ----------------------------------------------------------------------
981 *
982 * TkBackgroundEvalObjv --
983 *
984 * Evaluate a command while ensuring that we do not affect the
985 * interpreters state. This is important when evaluating script
986 * during background tasks.
987 *
988 * Results:
989 * A standard Tcl result code.
990 *
991 * Side Effects:
992 * The interpreters variables and code may be modified by the script
993 * but the result will not be modified.
994 *
995 * ----------------------------------------------------------------------
996 */
997
998 int
999 TkBackgroundEvalObjv(
1000 Tcl_Interp *interp,
1001 int objc,
1002 Tcl_Obj *const *objv,
1003 int flags)
1004 {
1005 Tcl_DString errorInfo, errorCode;
1006 Tcl_SavedResult state;
1007 int n, r = TCL_OK;
1008
1009 Tcl_DStringInit(&errorInfo);
1010 Tcl_DStringInit(&errorCode);
1011
1012 Tcl_Preserve(interp);
1013
1014 /*
1015 * Record the state of the interpreter
1016 */
1017
1018 Tcl_SaveResult(interp, &state);
1019 Tcl_DStringAppend(&errorInfo,
1020 Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY), -1);
1021 Tcl_DStringAppend(&errorCode,
1022 Tcl_GetVar(interp, "errorCode", TCL_GLOBAL_ONLY), -1);
1023
1024 /*
1025 * Evaluate the command and handle any error.
1026 */
1027
1028 for (n = 0; n < objc; ++n) {
1029 Tcl_IncrRefCount(objv[n]);
1030 }
1031 r = Tcl_EvalObjv(interp, objc, objv, flags);
1032 for (n = 0; n < objc; ++n) {
1033 Tcl_DecrRefCount(objv[n]);
1034 }
1035 if (r == TCL_ERROR) {
1036 Tcl_AddErrorInfo(interp, "\n (background event handler)");
1037 Tcl_BackgroundError(interp);
1038 }
1039
1040 Tcl_Release(interp);
1041
1042 /*
1043 * Restore the state of the interpreter
1044 */
1045
1046 Tcl_SetVar(interp, "errorInfo",
1047 Tcl_DStringValue(&errorInfo), TCL_GLOBAL_ONLY);
1048 Tcl_SetVar(interp, "errorCode",
1049 Tcl_DStringValue(&errorCode), TCL_GLOBAL_ONLY);
1050 Tcl_RestoreResult(interp, &state);
1051
1052 /*
1053 * Clean up references.
1054 */
1055
1056 Tcl_DStringFree(&errorInfo);
1057 Tcl_DStringFree(&errorCode);
1058
1059 return r;
1060 }
1061
1062 /*
1063 *----------------------------------------------------------------------
1064 *
1065 * TkMakeEnsemble --
1066 *
1067 * Create an ensemble from a table of implementation commands.
1068 * This may be called recursively to create sub-ensembles.
1069 *
1070 * Results:
1071 * Handle for the ensemble, or NULL if creation of it fails.
1072 *
1073 *----------------------------------------------------------------------
1074 */
1075
1076 Tcl_Command
1077 TkMakeEnsemble(
1078 Tcl_Interp *interp,
1079 const char *namespace,
1080 const char *name,
1081 ClientData clientData,
1082 const TkEnsemble map[])
1083 {
1084 Tcl_Namespace *namespacePtr = NULL;
1085 Tcl_Command ensemble = NULL;
1086 Tcl_Obj *dictObj = NULL;
1087 Tcl_DString ds;
1088 int i;
1089
1090 if (map == NULL) {
1091 return NULL;
1092 }
1093
1094 Tcl_DStringInit(&ds);
1095
1096 namespacePtr = Tcl_FindNamespace(interp, namespace, NULL, 0);
1097 if (namespacePtr == NULL) {
1098 namespacePtr = Tcl_CreateNamespace(interp, namespace, NULL, NULL);
1099 if (namespacePtr == NULL) {
1100 Tcl_Panic("failed to create namespace \"%s\"", namespace);
1101 }
1102 }
1103
1104 ensemble = Tcl_FindEnsemble(interp, Tcl_NewStringObj(name,-1), 0);
1105 if (ensemble == NULL) {
1106 ensemble = Tcl_CreateEnsemble(interp, name,
1107 namespacePtr, TCL_ENSEMBLE_PREFIX);
1108 if (ensemble == NULL) {
1109 Tcl_Panic("failed to create ensemble \"%s\"", name);
1110 }
1111 }
1112
1113 Tcl_DStringSetLength(&ds, 0);
1114 Tcl_DStringAppend(&ds, namespace, -1);
1115 if (!(strlen(namespace) == 2 && namespace[1] == ':')) {
1116 Tcl_DStringAppend(&ds, "::", -1);
1117 }
1118 Tcl_DStringAppend(&ds, name, -1);
1119
1120 dictObj = Tcl_NewObj();
1121 for (i = 0; map[i].name != NULL ; ++i) {
1122 Tcl_Obj *nameObj, *fqdnObj;
1123
1124 nameObj = Tcl_NewStringObj(map[i].name, -1);
1125 fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds),
1126 Tcl_DStringLength(&ds));
1127 Tcl_AppendStringsToObj(fqdnObj, "::", map[i].name, NULL);
1128 Tcl_DictObjPut(NULL, dictObj, nameObj, fqdnObj);
1129 if (map[i].proc) {
1130 Tcl_CreateObjCommand(interp, Tcl_GetString(fqdnObj),
1131 map[i].proc, clientData, NULL);
1132 } else if (map[i].subensemble) {
1133 TkMakeEnsemble(interp, Tcl_DStringValue(&ds),
1134 map[i].name, clientData, map[i].subensemble);
1135 }
1136 }
1137
1138 if (ensemble) {
1139 Tcl_SetEnsembleMappingDict(interp, ensemble, dictObj);
1140 }
1141
1142 Tcl_DStringFree(&ds);
1143 return ensemble;
1144 }
1145
1146 /*
1147 *----------------------------------------------------------------------
1148 *
1149 * TkSendVirtualEvent --
1150 *
1151 * Send a virtual event notification to the specified target window.
1152 * Equivalent to "event generate $target <<$eventName>>"
1153 *
1154 * Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent,
1155 * so this routine does not reenter the interpreter.
1156 *
1157 *----------------------------------------------------------------------
1158 */
1159
1160 void
1161 TkSendVirtualEvent(Tk_Window target, const char *eventName)
1162 {
1163 XEvent event;
1164
1165 memset(&event, 0, sizeof(event));
1166 event.xany.type = VirtualEvent;
1167 event.xany.serial = NextRequest(Tk_Display(target));
1168 event.xany.send_event = False;
1169 event.xany.window = Tk_WindowId(target);
1170 event.xany.display = Tk_Display(target);
1171 ((XVirtualEvent *) &event)->name = Tk_GetUid(eventName);
1172
1173 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
1174 }
1175 /*
9801176 * Local Variables:
9811177 * mode: c
9821178 * c-basic-offset: 4
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkVisual.c,v 1.11 2008/04/27 22:38:58 dkf Exp $
13 * RCS: @(#) $Id: tkVisual.c,v 1.12 2008/10/28 22:33:06 nijtmans Exp $
1414 */
1515
1616 #include "tkInt.h"
2121 */
2222
2323 typedef struct VisualDictionary {
24 char *name; /* Textual name of class. */
24 const char *name; /* Textual name of class. */
2525 int minLength; /* Minimum # characters that must be specified
2626 * for an unambiguous match. */
2727 int class; /* X symbol for class. */
2828 } VisualDictionary;
29 static VisualDictionary visualNames[] = {
29 static const VisualDictionary visualNames[] = {
3030 {"best", 1, 0},
3131 {"directcolor", 2, DirectColor},
3232 {"grayscale", 1, GrayScale},
103103 ptrdiff_t length;
104104 int c, numVisuals, prio, bestPrio, i;
105105 const char *p;
106 VisualDictionary *dictPtr;
106 const VisualDictionary *dictPtr;
107107 TkColormap *cmapPtr;
108108 TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
109109
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkWindow.c,v 1.96 2008/08/19 15:52:12 georgeps Exp $
13 * RCS: @(#) $Id: tkWindow.c,v 1.101 2008/12/10 00:34:51 das Exp $
1414 */
1515
1616 #include "tkInt.h"
9393 * The following structure defines all of the commands supported by Tk, and
9494 * the C functions that execute them.
9595 */
96
96 typedef int (TkInitProc)(Tcl_Interp *interp, ClientData clientData);
9797 typedef struct {
98 char *name; /* Name of command. */
98 const char *name; /* Name of command. */
9999 Tcl_CmdProc *cmdProc; /* Command's string-based function. */
100100 Tcl_ObjCmdProc *objProc; /* Command's object-based function. */
101 TkInitProc *initProc; /* Command's initialization function */
101102 int isSafe; /* If !0, this command will be exposed in a
102103 * safe interpreter. Otherwise it will be
103104 * hidden in a safe interpreter. */
111112 * Commands that are part of the intrinsics:
112113 */
113114
114 {"bell", NULL, Tk_BellObjCmd, 0, 1},
115 {"bind", NULL, Tk_BindObjCmd, 1, 1},
116 {"bindtags", NULL, Tk_BindtagsObjCmd, 1, 1},
117 {"clipboard", NULL, Tk_ClipboardObjCmd, 0, 1},
118 {"destroy", NULL, Tk_DestroyObjCmd, 1, 1},
119 {"event", NULL, Tk_EventObjCmd, 1, 1},
120 {"focus", NULL, Tk_FocusObjCmd, 1, 1},
121 {"font", NULL, Tk_FontObjCmd, 1, 1},
122 {"grab", NULL, Tk_GrabObjCmd, 0, 1},
123 {"grid", NULL, Tk_GridObjCmd, 1, 1},
124 {"image", NULL, Tk_ImageObjCmd, 1, 1},
125 {"lower", NULL, Tk_LowerObjCmd, 1, 1},
126 {"option", NULL, Tk_OptionObjCmd, 1, 1},
127 {"pack", NULL, Tk_PackObjCmd, 1, 1},
128 {"place", NULL, Tk_PlaceObjCmd, 1, 0},
129 {"raise", NULL, Tk_RaiseObjCmd, 1, 1},
130 {"selection", NULL, Tk_SelectionObjCmd, 0, 1},
131 {"tk", NULL, Tk_TkObjCmd, 1, 1},
132 {"tkwait", NULL, Tk_TkwaitObjCmd, 1, 1},
133 {"update", NULL, Tk_UpdateObjCmd, 1, 1},
134 {"winfo", NULL, Tk_WinfoObjCmd, 1, 1},
135 {"wm", NULL, Tk_WmObjCmd, 0, 1},
115 {"bell", NULL, Tk_BellObjCmd, NULL, 0, 1},
116 {"bind", NULL, Tk_BindObjCmd, NULL, 1, 1},
117 {"bindtags", NULL, Tk_BindtagsObjCmd, NULL, 1, 1},
118 {"clipboard", NULL, Tk_ClipboardObjCmd, NULL, 0, 1},
119 {"destroy", NULL, Tk_DestroyObjCmd, NULL, 1, 1},
120 {"event", NULL, Tk_EventObjCmd, NULL, 1, 1},
121 {"focus", NULL, Tk_FocusObjCmd, NULL, 1, 1},
122 {"font", NULL, Tk_FontObjCmd, NULL, 1, 1},
123 {"grab", NULL, Tk_GrabObjCmd, NULL, 0, 1},
124 {"grid", NULL, Tk_GridObjCmd, NULL, 1, 1},
125 {"image", NULL, Tk_ImageObjCmd, NULL, 1, 1},
126 {"lower", NULL, Tk_LowerObjCmd, NULL, 1, 1},
127 {"option", NULL, Tk_OptionObjCmd, NULL, 1, 1},
128 {"pack", NULL, Tk_PackObjCmd, NULL, 1, 1},
129 {"place", NULL, Tk_PlaceObjCmd, NULL, 1, 0},
130 {"raise", NULL, Tk_RaiseObjCmd, NULL, 1, 1},
131 {"selection", NULL, Tk_SelectionObjCmd, NULL, 0, 1},
132 {"tk", NULL, NULL, TkInitTkCmd, 1, 1},
133 {"tkwait", NULL, Tk_TkwaitObjCmd, NULL, 1, 1},
134 {"update", NULL, Tk_UpdateObjCmd, NULL, 1, 1},
135 {"winfo", NULL, Tk_WinfoObjCmd, NULL, 1, 1},
136 {"wm", NULL, Tk_WmObjCmd, NULL, 0, 1},
136137
137138 /*
138139 * Default widget class commands.
139140 */
140141
141 {"button", NULL, Tk_ButtonObjCmd, 1, 0},
142 {"canvas", NULL, Tk_CanvasObjCmd, 1, 1},
143 {"checkbutton", NULL, Tk_CheckbuttonObjCmd, 1, 0},
144 {"entry", NULL, Tk_EntryObjCmd, 1, 0},
145 {"frame", NULL, Tk_FrameObjCmd, 1, 0},
146 {"label", NULL, Tk_LabelObjCmd, 1, 0},
147 {"labelframe", NULL, Tk_LabelframeObjCmd, 1, 0},
148 {"listbox", NULL, Tk_ListboxObjCmd, 1, 0},
149 {"menubutton", NULL, Tk_MenubuttonObjCmd, 1, 0},
150 {"message", NULL, Tk_MessageObjCmd, 1, 0},
151 {"panedwindow", NULL, Tk_PanedWindowObjCmd, 1, 0},
152 {"radiobutton", NULL, Tk_RadiobuttonObjCmd, 1, 0},
153 {"scale", NULL, Tk_ScaleObjCmd, 1, 0},
154 {"scrollbar", Tk_ScrollbarCmd, NULL, 1, 1},
155 {"spinbox", NULL, Tk_SpinboxObjCmd, 1, 0},
156 {"text", NULL, Tk_TextObjCmd, 1, 1},
157 {"toplevel", NULL, Tk_ToplevelObjCmd, 0, 0},
142 {"button", NULL, Tk_ButtonObjCmd, NULL, 1, 0},
143 {"canvas", NULL, Tk_CanvasObjCmd, NULL, 1, 1},
144 {"checkbutton", NULL, Tk_CheckbuttonObjCmd, NULL, 1, 0},
145 {"entry", NULL, Tk_EntryObjCmd, NULL, 1, 0},
146 {"frame", NULL, Tk_FrameObjCmd, NULL, 1, 0},
147 {"label", NULL, Tk_LabelObjCmd, NULL, 1, 0},
148 {"labelframe", NULL, Tk_LabelframeObjCmd, NULL, 1, 0},
149 {"listbox", NULL, Tk_ListboxObjCmd, NULL, 1, 0},
150 {"menubutton", NULL, Tk_MenubuttonObjCmd, NULL, 1, 0},
151 {"message", NULL, Tk_MessageObjCmd, NULL, 1, 0},
152 {"panedwindow", NULL, Tk_PanedWindowObjCmd, NULL, 1, 0},
153 {"radiobutton", NULL, Tk_RadiobuttonObjCmd, NULL, 1, 0},
154 {"scale", NULL, Tk_ScaleObjCmd, NULL, 1, 0},
155 {"scrollbar", Tk_ScrollbarCmd,NULL, NULL, 1, 1},
156 {"spinbox", NULL, Tk_SpinboxObjCmd, NULL, 1, 0},
157 {"text", NULL, Tk_TextObjCmd, NULL, 1, 1},
158 {"toplevel", NULL, Tk_ToplevelObjCmd, NULL, 0, 0},
158159
159160 /*
160161 * Classic widget class commands.
161162 */
162163
163 {"::tk::button", NULL, Tk_ButtonObjCmd, 1, 0},
164 {"::tk::canvas", NULL, Tk_CanvasObjCmd, 1, 1},
165 {"::tk::checkbutton",NULL, Tk_CheckbuttonObjCmd, 1, 0},
166 {"::tk::entry", NULL, Tk_EntryObjCmd, 1, 0},
167 {"::tk::frame", NULL, Tk_FrameObjCmd, 1, 0},
168 {"::tk::label", NULL, Tk_LabelObjCmd, 1, 0},
169 {"::tk::labelframe",NULL, Tk_LabelframeObjCmd, 1, 0},
170 {"::tk::listbox", NULL, Tk_ListboxObjCmd, 1, 0},
171 {"::tk::menubutton",NULL, Tk_MenubuttonObjCmd, 1, 0},
172 {"::tk::message", NULL, Tk_MessageObjCmd, 1, 0},
173 {"::tk::panedwindow",NULL, Tk_PanedWindowObjCmd, 1, 0},
174 {"::tk::radiobutton",NULL, Tk_RadiobuttonObjCmd, 1, 0},
175 {"::tk::scale", NULL, Tk_ScaleObjCmd, 1, 0},
176 {"::tk::scrollbar", Tk_ScrollbarCmd, NULL, 1, 1},
177 {"::tk::spinbox", NULL, Tk_SpinboxObjCmd, 1, 0},
178 {"::tk::text", NULL, Tk_TextObjCmd, 1, 1},
179 {"::tk::toplevel", NULL, Tk_ToplevelObjCmd, 0, 0},
164 {"::tk::button", NULL, Tk_ButtonObjCmd, NULL, 1, 0},
165 {"::tk::canvas", NULL, Tk_CanvasObjCmd, NULL, 1, 1},
166 {"::tk::checkbutton",NULL, Tk_CheckbuttonObjCmd, NULL, 1, 0},
167 {"::tk::entry", NULL, Tk_EntryObjCmd, NULL, 1, 0},
168 {"::tk::frame", NULL, Tk_FrameObjCmd, NULL, 1, 0},
169 {"::tk::label", NULL, Tk_LabelObjCmd, NULL, 1, 0},
170 {"::tk::labelframe",NULL, Tk_LabelframeObjCmd, NULL, 1, 0},
171 {"::tk::listbox", NULL, Tk_ListboxObjCmd, NULL, 1, 0},
172 {"::tk::menubutton",NULL, Tk_MenubuttonObjCmd, NULL, 1, 0},
173 {"::tk::message", NULL, Tk_MessageObjCmd, NULL, 1, 0},
174 {"::tk::panedwindow",NULL, Tk_PanedWindowObjCmd, NULL, 1, 0},
175 {"::tk::radiobutton",NULL, Tk_RadiobuttonObjCmd, NULL, 1, 0},
176 {"::tk::scale", NULL, Tk_ScaleObjCmd, NULL, 1, 0},
177 {"::tk::scrollbar", Tk_ScrollbarCmd,NULL, NULL, 1, 1},
178 {"::tk::spinbox", NULL, Tk_SpinboxObjCmd, NULL, 1, 0},
179 {"::tk::text", NULL, Tk_TextObjCmd, NULL, 1, 1},
180 {"::tk::toplevel", NULL, Tk_ToplevelObjCmd, NULL, 0, 0},
180181
181182 /*
182183 * Standard dialog support. Note that the Unix/X11 platform implements
184185 */
185186
186187 #if defined(__WIN32__) || defined(MAC_OSX_TK)
187 {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, 0, 1},
188 {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd,0,1},
189 {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, 0, 1},
190 {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, 0, 1},
191 {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, 0, 1},
188 {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, NULL, 0, 1},
189 {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd,NULL, 0,1},
190 {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, NULL, 0, 1},
191 {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, NULL, 0, 1},
192 {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, NULL, 0, 1},
192193 #endif
193194
194195 /*
197198
198199 #if defined(MAC_OSX_TK)
199200 {"::tk::unsupported::MacWindowStyle",
200 NULL, TkUnsupported1ObjCmd, 1, 1},
201 NULL, TkUnsupported1ObjCmd, NULL, 1, 1},
201202 #endif
202 {NULL, NULL, NULL, 0, 0}
203 {NULL, NULL, NULL, NULL, 0, 0}
203204 };
204205
205206 /*
853854 const char *screenName, /* Name of screen on which to create window.
854855 * Empty or NULL string means use DISPLAY
855856 * environment variable. */
856 char *baseName) /* Base name for application; usually of the
857 const char *baseName) /* Base name for application; usually of the
857858 * form "prog instance". */
858859 {
859860 Tk_Window tkwin;
925926 hPtr = Tcl_CreateHashEntry(&mainPtr->nameTable, ".", &dummy);
926927 Tcl_SetHashValue(hPtr, winPtr);
927928 winPtr->pathName = Tcl_GetHashKey(&mainPtr->nameTable, hPtr);
929 Tcl_InitHashTable(&mainPtr->busyTable, TCL_ONE_WORD_KEYS);
928930
929931 /*
930932 * We have just created another Tk application; increment the refcount on
945947
946948 isSafe = Tcl_IsSafe(interp);
947949 for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
948 if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)) {
950 if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)
951 && (cmdPtr->initProc == NULL)) {
949952 Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
950953 }
951954 if (cmdPtr->passMainWindow) {
953956 } else {
954957 clientData = NULL;
955958 }
956 if (cmdPtr->cmdProc != NULL) {
959 if (cmdPtr->initProc != NULL) {
960 cmdPtr->initProc(interp, clientData);
961 } else if (cmdPtr->cmdProc != NULL) {
957962 Tcl_CreateCommand(interp, cmdPtr->name, cmdPtr->cmdProc,
958963 clientData, NULL);
959964 } else {
10171022 * window. */
10181023 {
10191024 TkWindow *parentPtr = (TkWindow *) parent;
1020 TkWindow *winPtr;
1021
1022 if ((parentPtr != NULL) && (parentPtr->flags & TK_ALREADY_DEAD)) {
1023 Tcl_AppendResult(interp,
1024 "can't create window: parent has been destroyed", NULL);
1025 return NULL;
1026 } else if ((parentPtr != NULL) &&
1027 (parentPtr->flags & TK_CONTAINER)) {
1028 Tcl_AppendResult(interp,
1029 "can't create window: its parent has -container = yes", NULL);
1030 return NULL;
1031 }
1032
1033 if (screenName == NULL) {
1034 winPtr = TkAllocWindow(parentPtr->dispPtr, parentPtr->screenNum,
1035 parentPtr);
1036 if (NameWindow(interp, winPtr, parentPtr, name) != TCL_OK) {
1037 Tk_DestroyWindow((Tk_Window) winPtr);
1025
1026 if (parentPtr) {
1027 if (parentPtr->flags & TK_ALREADY_DEAD) {
1028 Tcl_AppendResult(interp,
1029 "can't create window: parent has been destroyed", NULL);
10381030 return NULL;
1039 }
1040 return (Tk_Window) winPtr;
1031 } else if (parentPtr->flags & TK_CONTAINER) {
1032 Tcl_AppendResult(interp,
1033 "can't create window: its parent has -container = yes",
1034 NULL);
1035 return NULL;
1036 } else if (screenName == NULL) {
1037 TkWindow *winPtr = TkAllocWindow(parentPtr->dispPtr,
1038 parentPtr->screenNum, parentPtr);
1039
1040 if (NameWindow(interp, winPtr, parentPtr, name) != TCL_OK) {
1041 Tk_DestroyWindow((Tk_Window) winPtr);
1042 return NULL;
1043 }
1044 return (Tk_Window) winPtr;
1045 }
10411046 }
10421047 return CreateTopLevelWindow(interp, parent, name, screenName,
10431048 /* flags */ 0);
10791084 * window. */
10801085 {
10811086 TkWindow *parentPtr = (TkWindow *) parent;
1082 TkWindow *winPtr;
1083
1084 if ((parentPtr != NULL) && (parentPtr->flags & TK_ALREADY_DEAD)) {
1085 Tcl_AppendResult(interp,
1086 "can't create window: parent has been destroyed", NULL);
1087 return NULL;
1088 } else if ((parentPtr != NULL) &&
1089 (parentPtr->flags & TK_CONTAINER)) {
1090 Tcl_AppendResult(interp,
1091 "can't create window: its parent has -container = yes", NULL);
1092 return NULL;
1093 }
1094 if (screenName == NULL) {
1095 winPtr = TkAllocWindow(parentPtr->dispPtr, parentPtr->screenNum,
1096 parentPtr);
1097 /*
1098 * Add the anonymous window flag now, so that NameWindow will behave
1099 * correctly.
1100 */
1101
1102 winPtr->flags |= TK_ANONYMOUS_WINDOW;
1103 if (NameWindow(interp, winPtr, parentPtr, NULL) != TCL_OK) {
1104 Tk_DestroyWindow((Tk_Window) winPtr);
1087
1088 if (parentPtr) {
1089 if (parentPtr->flags & TK_ALREADY_DEAD) {
1090 Tcl_AppendResult(interp,
1091 "can't create window: parent has been destroyed", NULL);
11051092 return NULL;
1106 }
1107 return (Tk_Window) winPtr;
1093 } else if (parentPtr->flags & TK_CONTAINER) {
1094 Tcl_AppendResult(interp,
1095 "can't create window: its parent has -container = yes",
1096 NULL);
1097 return NULL;
1098 } else if (screenName == NULL) {
1099 TkWindow *winPtr = TkAllocWindow(parentPtr->dispPtr,
1100 parentPtr->screenNum, parentPtr);
1101 /*
1102 * Add the anonymous window flag now, so that NameWindow will
1103 * behave correctly.
1104 */
1105
1106 winPtr->flags |= TK_ANONYMOUS_WINDOW;
1107 if (NameWindow(interp, winPtr, parentPtr, NULL) != TCL_OK) {
1108 Tk_DestroyWindow((Tk_Window) winPtr);
1109 return NULL;
1110 }
1111 return (Tk_Window) winPtr;
1112 }
11081113 }
11091114 return CreateTopLevelWindow(interp, parent, NULL, screenName,
11101115 TK_ANONYMOUS_WINDOW);
15281533 "::tk::AlwaysShowSelection");
15291534 }
15301535
1536 Tcl_DeleteHashTable(&winPtr->mainPtr->busyTable);
15311537 Tcl_DeleteHashTable(&winPtr->mainPtr->nameTable);
15321538 TkBindFree(winPtr->mainPtr);
15331539 TkDeleteAllImages(winPtr->mainPtr);
17031709
17041710 createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc);
17051711 if (createProc != NULL && parent != None) {
1706 winPtr->window = (*createProc)(tkwin, parent, winPtr->instanceData);
1712 winPtr->window = createProc(tkwin, parent, winPtr->instanceData);
17071713 } else {
17081714 winPtr->window = TkpMakeWindow(winPtr, parent);
17091715 }
29322938 char *p;
29332939 int argc, code;
29342940 const char **argv;
2935 char *args[20];
2941 const char *args[20];
29362942 const char *argString = NULL;
29372943 Tcl_DString class;
29382944 ThreadSpecificData *tsdPtr;
00 #
1 # $Id: ttk.decls,v 1.2 2006/12/10 19:19:44 jenglish Exp $
1 # $Id: ttk.decls,v 1.3 2008/10/22 20:56:43 nijtmans Exp $
22 #
33
44 library ttk
2626
2727 declare 5 current {
2828 int Ttk_RegisterElementSpec(
29 Ttk_Theme theme,
29 Ttk_Theme theme,
3030 const char *elementName,
3131 Ttk_ElementSpec *elementSpec,
3232 void *clientData);
3535 declare 6 current {
3636 Ttk_ElementImpl Ttk_RegisterElement(
3737 Tcl_Interp *interp,
38 Ttk_Theme theme,
38 Ttk_Theme theme,
3939 const char *elementName,
4040 Ttk_ElementSpec *elementSpec,
4141 void *clientData);
4343
4444 declare 7 current {
4545 int Ttk_RegisterElementFactory(
46 Tcl_Interp *interp,
46 Tcl_Interp *interp,
4747 const char *name,
4848 Ttk_ElementFactory factoryProc,
4949 void *clientData);
8484 #
8585 declare 20 current {
8686 int Ttk_GetPaddingFromObj(
87 Tcl_Interp *interp,
88 Tk_Window tkwin,
89 Tcl_Obj *objPtr,
87 Tcl_Interp *interp,
88 Tk_Window tkwin,
89 Tcl_Obj *objPtr,
9090 Ttk_Padding *pad_rtn);
9191 }
9292 declare 21 current {
9393 int Ttk_GetBorderFromObj(
94 Tcl_Interp *interp,
95 Tcl_Obj *objPtr,
94 Tcl_Interp *interp,
95 Tcl_Obj *objPtr,
9696 Ttk_Padding *pad_rtn);
9797 }
9898 declare 22 current {
0 /* $Id: ttkButton.c,v 1.9 2008/04/27 22:41:12 dkf Exp $
0 /* $Id: ttkButton.c,v 1.11 2008/11/13 01:13:54 jenglish Exp $
11 * Copyright (c) 2003, Joe English
22 *
33 * label, button, checkbutton, radiobutton, and menubutton widgets.
5656 static Tk_OptionSpec BaseOptionSpecs[] =
5757 {
5858 {TK_OPTION_STRING, "-text", "text", "Text", "",
59 Tk_Offset(Base,base.textObj), -1,
59 Tk_Offset(Base,base.textObj), -1,
6060 0,0,GEOMETRY_CHANGED },
6161 {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", "",
62 Tk_Offset(Base,base.textVariableObj), -1,
62 Tk_Offset(Base,base.textVariableObj), -1,
6363 TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
6464 {TK_OPTION_INT, "-underline", "underline", "Underline",
65 "-1", Tk_Offset(Base,base.underlineObj), -1,
65 "-1", Tk_Offset(Base,base.underlineObj), -1,
6666 0,0,0 },
6767 /* SB: OPTION_INT, see <<NOTE-NULLOPTIONS>> */
6868 {TK_OPTION_STRING, "-width", "width", "Width",
69 NULL, Tk_Offset(Base,base.widthObj), -1,
69 NULL, Tk_Offset(Base,base.widthObj), -1,
7070 TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
7171
7272 /*
7373 * Image options
7474 */
7575 {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
76 Tk_Offset(Base,base.imageObj), -1,
76 Tk_Offset(Base,base.imageObj), -1,
7777 TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
7878
7979 /*
117117 TtkResizeWidget(&basePtr->core);
118118 }
119119
120 static int
120 static void
121121 BaseInitialize(Tcl_Interp *interp, void *recordPtr)
122122 {
123123 Base *basePtr = recordPtr;
124124 basePtr->base.textVariableTrace = 0;
125125 basePtr->base.imageSpec = NULL;
126 return TCL_OK;
127126 }
128127
129128 static void
132131 Base *basePtr = recordPtr;
133132 if (basePtr->base.textVariableTrace)
134133 Ttk_UntraceVariable(basePtr->base.textVariableTrace);
135 if (basePtr->base.imageSpec)
134 if (basePtr->base.imageSpec)
136135 TtkFreeImageSpec(basePtr->base.imageSpec);
137136 }
138137
219218
220219 static Tk_OptionSpec LabelOptionSpecs[] =
221220 {
222 {TK_OPTION_BORDER, "-background", "frameColor", "FrameColor",
221 {TK_OPTION_BORDER, "-background", "frameColor", "FrameColor",
223222 NULL, Tk_Offset(Label,label.backgroundObj), -1,
224223 TK_OPTION_NULL_OK,0,0 },
225 {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
224 {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
226225 NULL, Tk_Offset(Label,label.foregroundObj), -1,
227226 TK_OPTION_NULL_OK,0,0 },
228227 {TK_OPTION_FONT, "-font", "font", "Font",
229228 NULL, Tk_Offset(Label,label.fontObj), -1,
230229 TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
231 {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
230 {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
232231 NULL, Tk_Offset(Label,label.borderWidthObj), -1,
233232 TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
234233 {TK_OPTION_RELIEF, "-relief", "relief", "Relief",
235234 NULL, Tk_Offset(Label,label.reliefObj), -1,
236235 TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
237236 {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
238 NULL, Tk_Offset(Label,label.anchorObj), -1,
237 NULL, Tk_Offset(Label,label.anchorObj), -1,
239238 TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED},
240239 {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
241240 NULL, Tk_Offset(Label, label.justifyObj), -1,
417416 WIDGET_TAKES_FOCUS,
418417
419418 {TK_OPTION_STRING, "-variable", "variable", "Variable",
420 "", Tk_Offset(Checkbutton, checkbutton.variableObj), -1, 0,0,0},
419 "", Tk_Offset(Checkbutton, checkbutton.variableObj), -1,
420 TK_OPTION_DONT_SET_DEFAULT,0,0},
421421 {TK_OPTION_STRING, "-onvalue", "onValue", "OnValue",
422 "1", Tk_Offset(Checkbutton, checkbutton.onValueObj), -1, 0,0,0},
422 "1", Tk_Offset(Checkbutton, checkbutton.onValueObj), -1,
423 0,0,0},
423424 {TK_OPTION_STRING, "-offvalue", "offValue", "OffValue",
424 "0", Tk_Offset(Checkbutton, checkbutton.offValueObj), -1, 0,0,0},
425 "0", Tk_Offset(Checkbutton, checkbutton.offValueObj), -1,
426 0,0,0},
425427 {TK_OPTION_STRING, "-command", "command", "Command",
426 "", Tk_Offset(Checkbutton, checkbutton.commandObj), -1, 0,0,0},
428 "", Tk_Offset(Checkbutton, checkbutton.commandObj), -1,
429 0,0,0},
427430
428431 WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
429432 };
452455 }
453456 }
454457
455 static int CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr)
458 static void
459 CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr)
456460 {
457461 Checkbutton *checkPtr = recordPtr;
458 Tcl_Obj *objPtr;
462 Tcl_Obj *variableObj;
459463
460464 /* default -variable is the widget name:
461465 */
462 objPtr = Tcl_NewStringObj(Tk_PathName(checkPtr->core.tkwin), -1);
463 Tcl_IncrRefCount(objPtr);
464 Tcl_DecrRefCount(checkPtr->checkbutton.variableObj);
465 checkPtr->checkbutton.variableObj = objPtr;
466
467 return BaseInitialize(interp, recordPtr);
466 variableObj = Tcl_NewStringObj(Tk_PathName(checkPtr->core.tkwin), -1);
467 Tcl_IncrRefCount(variableObj);
468 checkPtr->checkbutton.variableObj = variableObj;
469 BaseInitialize(interp, recordPtr);
468470 }
469471
470472 static void
631633 /*
632634 * Variable trace procedure for radiobuttons.
633635 */
634 static void
636 static void
635637 RadiobuttonVariableChanged(void *clientData, const char *value)
636638 {
637639 Radiobutton *radioPtr = clientData;
00 /*
1 * $Id: ttkDecls.h,v 1.6 2008/03/27 12:04:02 das Exp $
1 * $Id: ttkDecls.h,v 1.7 2008/10/22 20:56:43 nijtmans Exp $
22 *
33 * This file is (mostly) automatically generated from ttk.decls.
44 */
3737 /* 2 */
3838 TTKAPI Ttk_Theme Ttk_GetCurrentTheme (Tcl_Interp * interp);
3939 /* 3 */
40 TTKAPI Ttk_Theme Ttk_CreateTheme (Tcl_Interp * interp,
40 TTKAPI Ttk_Theme Ttk_CreateTheme (Tcl_Interp * interp,
4141 const char * name, Ttk_Theme parent);
4242 /* 4 */
43 TTKAPI void Ttk_RegisterCleanup (Tcl_Interp * interp,
44 void * deleteData,
43 TTKAPI void Ttk_RegisterCleanup (Tcl_Interp * interp,
44 void * deleteData,
4545 Ttk_CleanupProc * cleanupProc);
4646 /* 5 */
47 TTKAPI int Ttk_RegisterElementSpec (Ttk_Theme theme,
48 const char * elementName,
49 Ttk_ElementSpec * elementSpec,
47 TTKAPI int Ttk_RegisterElementSpec (Ttk_Theme theme,
48 const char * elementName,
49 Ttk_ElementSpec * elementSpec,
5050 void * clientData);
5151 /* 6 */
52 TTKAPI Ttk_ElementImpl Ttk_RegisterElement (Tcl_Interp * interp,
53 Ttk_Theme theme, const char * elementName,
54 Ttk_ElementSpec * elementSpec,
52 TTKAPI Ttk_ElementImpl Ttk_RegisterElement (Tcl_Interp * interp,
53 Ttk_Theme theme, const char * elementName,
54 Ttk_ElementSpec * elementSpec,
5555 void * clientData);
5656 /* 7 */
57 TTKAPI int Ttk_RegisterElementFactory (Tcl_Interp * interp,
58 const char * name,
59 Ttk_ElementFactory factoryProc,
57 TTKAPI int Ttk_RegisterElementFactory (Tcl_Interp * interp,
58 const char * name,
59 Ttk_ElementFactory factoryProc,
6060 void * clientData);
6161 /* 8 */
62 TTKAPI void Ttk_RegisterLayout (Ttk_Theme theme,
63 const char * className,
62 TTKAPI void Ttk_RegisterLayout (Ttk_Theme theme,
63 const char * className,
6464 Ttk_LayoutSpec layoutSpec);
6565 /* Slot 9 is reserved */
6666 /* 10 */
67 TTKAPI int Ttk_GetStateSpecFromObj (Tcl_Interp * interp,
67 TTKAPI int Ttk_GetStateSpecFromObj (Tcl_Interp * interp,
6868 Tcl_Obj * objPtr, Ttk_StateSpec * spec_rtn);
6969 /* 11 */
70 TTKAPI Tcl_Obj * Ttk_NewStateSpecObj (unsigned int onbits,
70 TTKAPI Tcl_Obj * Ttk_NewStateSpecObj (unsigned int onbits,
7171 unsigned int offbits);
7272 /* 12 */
73 TTKAPI Ttk_StateMap Ttk_GetStateMapFromObj (Tcl_Interp * interp,
73 TTKAPI Ttk_StateMap Ttk_GetStateMapFromObj (Tcl_Interp * interp,
7474 Tcl_Obj * objPtr);
7575 /* 13 */
76 TTKAPI Tcl_Obj * Ttk_StateMapLookup (Tcl_Interp * interp,
76 TTKAPI Tcl_Obj * Ttk_StateMapLookup (Tcl_Interp * interp,
7777 Ttk_StateMap map, Ttk_State state);
7878 /* 14 */
79 TTKAPI int Ttk_StateTableLookup (Ttk_StateTable map[],
79 TTKAPI int Ttk_StateTableLookup (Ttk_StateTable map[],
8080 Ttk_State state);
8181 /* Slot 15 is reserved */
8282 /* Slot 16 is reserved */
8484 /* Slot 18 is reserved */
8585 /* Slot 19 is reserved */
8686 /* 20 */
87 TTKAPI int Ttk_GetPaddingFromObj (Tcl_Interp * interp,
88 Tk_Window tkwin, Tcl_Obj * objPtr,
87 TTKAPI int Ttk_GetPaddingFromObj (Tcl_Interp * interp,
88 Tk_Window tkwin, Tcl_Obj * objPtr,
8989 Ttk_Padding * pad_rtn);
9090 /* 21 */
91 TTKAPI int Ttk_GetBorderFromObj (Tcl_Interp * interp,
91 TTKAPI int Ttk_GetBorderFromObj (Tcl_Interp * interp,
9292 Tcl_Obj * objPtr, Ttk_Padding * pad_rtn);
9393 /* 22 */
94 TTKAPI int Ttk_GetStickyFromObj (Tcl_Interp * interp,
94 TTKAPI int Ttk_GetStickyFromObj (Tcl_Interp * interp,
9595 Tcl_Obj * objPtr, Ttk_Sticky * sticky_rtn);
9696 /* 23 */
9797 TTKAPI Ttk_Padding Ttk_MakePadding (short l, short t, short r, short b);
100100 /* 25 */
101101 TTKAPI Ttk_Padding Ttk_AddPadding (Ttk_Padding pad1, Ttk_Padding pad2);
102102 /* 26 */
103 TTKAPI Ttk_Padding Ttk_RelievePadding (Ttk_Padding padding, int relief,
103 TTKAPI Ttk_Padding Ttk_RelievePadding (Ttk_Padding padding, int relief,
104104 int n);
105105 /* 27 */
106106 TTKAPI Ttk_Box Ttk_MakeBox (int x, int y, int width, int height);
107107 /* 28 */
108108 TTKAPI int Ttk_BoxContains (Ttk_Box box, int x, int y);
109109 /* 29 */
110 TTKAPI Ttk_Box Ttk_PackBox (Ttk_Box * cavity, int w, int h,
110 TTKAPI Ttk_Box Ttk_PackBox (Ttk_Box * cavity, int w, int h,
111111 Ttk_Side side);
112112 /* 30 */
113 TTKAPI Ttk_Box Ttk_StickBox (Ttk_Box parcel, int w, int h,
113 TTKAPI Ttk_Box Ttk_StickBox (Ttk_Box parcel, int w, int h,
114114 Ttk_Sticky sticky);
115115 /* 31 */
116 TTKAPI Ttk_Box Ttk_AnchorBox (Ttk_Box parcel, int w, int h,
116 TTKAPI Ttk_Box Ttk_AnchorBox (Ttk_Box parcel, int w, int h,
117117 Tk_Anchor anchor);
118118 /* 32 */
119119 TTKAPI Ttk_Box Ttk_PadBox (Ttk_Box b, Ttk_Padding p);
120120 /* 33 */
121121 TTKAPI Ttk_Box Ttk_ExpandBox (Ttk_Box b, Ttk_Padding p);
122122 /* 34 */
123 TTKAPI Ttk_Box Ttk_PlaceBox (Ttk_Box * cavity, int w, int h,
123 TTKAPI Ttk_Box Ttk_PlaceBox (Ttk_Box * cavity, int w, int h,
124124 Ttk_Side side, Ttk_Sticky sticky);
125125 /* 35 */
126126 TTKAPI Tcl_Obj * Ttk_NewBoxObj (Ttk_Box box);
129129 /* Slot 38 is reserved */
130130 /* Slot 39 is reserved */
131131 /* 40 */
132 TTKAPI int Ttk_GetOrientFromObj (Tcl_Interp * interp,
132 TTKAPI int Ttk_GetOrientFromObj (Tcl_Interp * interp,
133133 Tcl_Obj * objPtr, int * orient);
134134
135135 #endif /* !defined(USE_TTK_STUBS) */
0 /* $Id: ttkDefaultTheme.c,v 1.12 2008/07/04 19:05:04 jenglish Exp $
0 /* $Id: ttkDefaultTheme.c,v 1.13 2008/11/02 09:54:02 nijtmans Exp $
11 *
22 * Copyright (c) 2003, Joe English
33 *
3838 enum BorderColor { FLAT = 1, LITE = 2, DARK = 3, BRDR = 4 };
3939
4040 /* top-left outer, top-left inner, bottom-right inner, bottom-right outer */
41 static int shadowColors[6][4] =
41 static int const shadowColors[6][4] =
4242 {
4343 { FLAT, FLAT, FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/
4444 { DARK, LITE, DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/
4949 };
5050
5151 /* top-left, bottom-right */
52 static int thinShadowColors[6][4] =
52 static int const thinShadowColors[6][4] =
5353 {
5454 { FLAT, FLAT }, /* TK_RELIEF_FLAT = 0*/
5555 { DARK, LITE }, /* TK_RELIEF_GROOVE = 1*/
203203 * TtkDrawArrow, TtkFillArrow --
204204 * Draw an arrow in the indicated direction inside the specified box.
205205 */
206 /*public*/
206 /*public*/
207207 void TtkFillArrow(
208208 Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir)
209209 {
213213 XDrawLines(display, d, gc, points, 4, CoordModeOrigin);
214214 }
215215
216 /*public*/
216 /*public*/
217217 void TtkDrawArrow(
218218 Display *display, Drawable d, GC gc, Ttk_Box b, ArrowDirection dir)
219219 {
295295
296296 if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) {
297297 GC gc = Tk_GCForColor(borderColor, d);
298 XDrawRectangle(Tk_Display(tkwin), d, gc,
298 XDrawRectangle(Tk_Display(tkwin), d, gc,
299299 b.x, b.y, b.width-1, b.height-1);
300300 }
301301 if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) {
378378 int width; /* Width of each image */
379379 int height; /* Height of each image */
380380 int nimages; /* #images / row */
381 char **pixels; /* array[height] of char[width*nimage] */
381 const char *const *pixels; /* array[height] of char[width*nimage] */
382382 Ttk_StateTable *map;/* used to look up image index by state */
383383 } IndicatorSpec;
384384
385385 #if 0
386386 /*XPM*/
387 static char *button_images[] = {
387 static const char *const button_images[] = {
388388 /* width height ncolors chars_per_pixel */
389389 "52 26 7 1",
390390 /* colors */
407407 { 3, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0 },
408408 { 0, 0, 0 }
409409 };
410 static char *checkbutton_pixels[] = {
410 static const char *const checkbutton_pixels[] = {
411411 "AAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAAB",
412412 "AEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECBAEEEEEEEEEECB",
413413 "AEDDDDDDDDDCBAEDDDDDDDDDCBAEFFFFFFFFFCBAEFFFFFFFFFCB",
439439 { 0, 0, 0 }
440440 };
441441
442 static char *radiobutton_pixels[] = {
442 static const char *const radiobutton_pixels[] = {
443443 "FFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFFFFFFAAAAFFFFF",
444444 "FFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFFFFAAEEEEAAFFF",
445445 "FAEEDDDDECBFFFAEEDDDDECBFFFAEEFFFFECBFFFAEEFFFFECBFF",
620620 {
621621 { "-arrowsize", TK_OPTION_PIXELS,
622622 Tk_Offset(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) },
623 { "-background", TK_OPTION_BORDER,
623 { "-background", TK_OPTION_BORDER,
624624 Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND },
625 { "-bordercolor", TK_OPTION_COLOR,
625 { "-bordercolor", TK_OPTION_COLOR,
626626 Tk_Offset(ArrowElement,borderColorObj), "black" },
627627 { "-relief", TK_OPTION_RELIEF,
628628 Tk_Offset(ArrowElement,reliefObj),"raised"},
00 /*
1 * $Id: ttkEntry.c,v 1.9 2007/05/18 21:46:11 jenglish Exp $
1 * $Id: ttkEntry.c,v 1.16 2008/12/15 17:51:31 das Exp $
22 *
33 * DERIVED FROM: tk/generic/tkEntry.c r1.35.
44 *
7272
7373 /* Style parameters:
7474 */
75 typedef struct
76 {
75 typedef struct {
7776 Tcl_Obj *foregroundObj; /* Foreground color for normal text */
7877 Tcl_Obj *backgroundObj; /* Entry widget background color */
7978 Tcl_Obj *selBorderObj; /* Border and background for selection */
8382 Tcl_Obj *insertWidthObj; /* Insert cursor width */
8483 } EntryStyleData;
8584
86 typedef struct
87 {
85 typedef struct {
8886 /*
8987 * Internal state:
9088 */
134132
135133 } EntryPart;
136134
137 typedef struct
138 {
135 typedef struct {
139136 WidgetCore core;
140137 EntryPart entry;
141138 } Entry;
157154 #define DEF_ENTRY_FONT "TkTextFont"
158155 #define DEF_LIST_HEIGHT "10"
159156
160 static Tk_OptionSpec EntryOptionSpecs[] =
161 {
157 static Tk_OptionSpec EntryOptionSpecs[] = {
162158 WIDGET_TAKES_FOCUS,
163159
164160 {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
522518 ExpandPercents(entryPtr, template, new, index, count, reason, &script);
523519 code = Tcl_EvalEx(interp,
524520 Tcl_DStringValue(&script), Tcl_DStringLength(&script),
525 TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
521 TCL_EVAL_GLOBAL);
526522 Tcl_DStringFree(&script);
527523 if (WidgetDestroyed(&entryPtr->core))
528524 return TCL_ERROR;
565561 * TCL_BREAK if the change is rejected
566562 * TCL_ERROR if any errors occured
567563 *
568 * The change will be rejected if -validatecommand returns 0,
564 * The change will be rejected if -validatecommand returns 0,
569565 * or if -validatecommand or -invalidcommand modifies the value.
570566 */
571567 static int
924920 * +++ Initialization and cleanup.
925921 */
926922
927 static int
923 static void
928924 EntryInitialize(Tcl_Interp *interp, void *recordPtr)
929925 {
930926 Entry *entryPtr = recordPtr;
949945 entryPtr->entry.insertPos = 0;
950946 entryPtr->entry.selectFirst = -1;
951947 entryPtr->entry.selectLast = -1;
952
953 return TCL_OK;
954948 }
955949
956950 static void
11871181
11881182 EntryInitStyleData(entryPtr, &es);
11891183
1190 showCursor =
1184 showCursor =
11911185 (entryPtr->core.flags & CURSOR_ON) != 0
11921186 && EntryEditable(entryPtr)
11931187 && entryPtr->entry.insertPos >= leftIndex
12491243 Tk_SetCaretPos(tkwin, cursorX, cursorY, cursorHeight);
12501244
12511245 gc = EntryGetGC(entryPtr, es.insertColorObj);
1252 XFillRectangle(Tk_Display(tkwin), d, gc,
1246 XFillRectangle(Tk_Display(tkwin), d, gc,
12531247 cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight);
12541248 Tk_FreeGC(Tk_Display(tkwin), gc);
12551249 }
13911385 if ((index == entryPtr->entry.numChars) && (index > 0)) {
13921386 index--;
13931387 }
1394 Tk_CharBbox(entryPtr->entry.textLayout, index,
1388 Tk_CharBbox(entryPtr->entry.textLayout, index,
13951389 &b.x, &b.y, &b.width, &b.height);
13961390 b.x += entryPtr->entry.layoutX;
13971391 b.y += entryPtr->entry.layoutY;
16381632 return TtkScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle);
16391633 }
16401634
1641 static WidgetCommandSpec EntryCommands[] =
1642 {
1635 static WidgetCommandSpec EntryCommands[] = {
16431636 { "bbox", EntryBBoxCommand },
16441637 { "cget", TtkWidgetCgetCommand },
16451638 { "configure", TtkWidgetConfigureCommand },
16611654 * +++ Entry widget definition.
16621655 */
16631656
1664 static WidgetSpec EntryWidgetSpec =
1665 {
1657 static WidgetSpec EntryWidgetSpec = {
16661658 "TEntry", /* className */
16671659 sizeof(Entry), /* recordSize */
16681660 EntryOptionSpecs, /* optionSpecs */
16941686 ComboboxPart combobox;
16951687 } Combobox;
16961688
1697 static Tk_OptionSpec ComboboxOptionSpecs[] =
1698 {
1689 static Tk_OptionSpec ComboboxOptionSpecs[] = {
16991690 {TK_OPTION_STRING, "-height", "height", "Height",
17001691 DEF_LIST_HEIGHT, Tk_Offset(Combobox, combobox.heightObj), -1,
17011692 0,0,0 },
17111702 /* ComboboxInitialize --
17121703 * Initialization hook for combobox widgets.
17131704 */
1714 static int
1705 static void
17151706 ComboboxInitialize(Tcl_Interp *interp, void *recordPtr)
17161707 {
17171708 Combobox *cb = recordPtr;
1709
17181710 cb->combobox.currentIndex = -1;
17191711 TtkTrackElementState(&cb->core);
1720 return EntryInitialize(interp, recordPtr);
1712 EntryInitialize(interp, recordPtr);
17211713 }
17221714
17231715 /* ComboboxConfigure --
17411733 * Setting the current index updates the combobox value,
17421734 * but the value and -values may be changed independently
17431735 * of the index. Instead of trying to keep currentIndex
1744 * in sync at all times, [$cb current] double-checks
1736 * in sync at all times, [$cb current] double-checks
17451737 */
17461738 static int ComboboxCurrentCommand(
17471739 Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
17571749 if (objc == 2) {
17581750 /* Check if currentIndex still valid:
17591751 */
1760 if ( currentIndex < 0
1752 if ( currentIndex < 0
17611753 || currentIndex >= nValues
17621754 || strcmp(currentValue,Tcl_GetString(values[currentIndex]))
17631755 )
17821774 return TCL_ERROR;
17831775 }
17841776 if (currentIndex < 0 || currentIndex >= nValues) {
1785 Tcl_AppendResult(interp,
1777 Tcl_AppendResult(interp,
17861778 "Index ", Tcl_GetString(objv[2]), " out of range",
17871779 NULL);
17881780 return TCL_ERROR;
18011793 /*------------------------------------------------------------------------
18021794 * +++ Combobox widget definition.
18031795 */
1804 static WidgetCommandSpec ComboboxCommands[] =
1805 {
1796 static WidgetCommandSpec ComboboxCommands[] = {
18061797 { "bbox", EntryBBoxCommand },
18071798 { "cget", TtkWidgetCgetCommand },
18081799 { "configure", TtkWidgetConfigureCommand },
18211812 {0,0}
18221813 };
18231814
1824 static WidgetSpec ComboboxWidgetSpec =
1825 {
1815 static WidgetSpec ComboboxWidgetSpec = {
18261816 "TCombobox", /* className */
18271817 sizeof(Combobox), /* recordSize */
18281818 ComboboxOptionSpecs, /* optionSpecs */
18381828 };
18391829
18401830 /*------------------------------------------------------------------------
1831 * +++ Spinbox widget.
1832 */
1833
1834 typedef struct {
1835 Tcl_Obj *valuesObj;
1836
1837 Tcl_Obj *fromObj;
1838 Tcl_Obj *toObj;
1839 Tcl_Obj *incrementObj;
1840 Tcl_Obj *formatObj;
1841
1842 Tcl_Obj *wrapObj;
1843 Tcl_Obj *commandObj;
1844 } SpinboxPart;
1845
1846 typedef struct {
1847 WidgetCore core;
1848 EntryPart entry;
1849 SpinboxPart spinbox;
1850 } Spinbox;
1851
1852 static Tk_OptionSpec SpinboxOptionSpecs[] = {
1853 {TK_OPTION_STRING, "-values", "values", "Values",
1854 "", Tk_Offset(Spinbox, spinbox.valuesObj), -1,
1855 0,0,0 },
1856
1857 {TK_OPTION_DOUBLE, "-from", "from", "From",
1858 "0", Tk_Offset(Spinbox,spinbox.fromObj), -1,
1859 0,0,0 },
1860 {TK_OPTION_DOUBLE, "-to", "to", "To",
1861 "0", Tk_Offset(Spinbox,spinbox.toObj), -1,
1862 0,0,0 },
1863 {TK_OPTION_DOUBLE, "-increment", "increment", "Increment",
1864 "1", Tk_Offset(Spinbox,spinbox.incrementObj), -1,
1865 0,0,0 },
1866 {TK_OPTION_STRING, "-format", "format", "Format",
1867 "", Tk_Offset(Spinbox, spinbox.formatObj), -1,
1868 0,0,0 },
1869
1870 {TK_OPTION_STRING, "-command", "command", "Command",
1871 "", Tk_Offset(Spinbox, spinbox.commandObj), -1,
1872 0,0,0 },
1873 {TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap",
1874 "0", Tk_Offset(Spinbox,spinbox.wrapObj), -1,
1875 0,0,0 },
1876
1877 WIDGET_INHERIT_OPTIONS(EntryOptionSpecs)
1878 };
1879
1880 /* SpinboxInitialize --
1881 * Initialization hook for spinbox widgets.
1882 */
1883 static void
1884 SpinboxInitialize(Tcl_Interp *interp, void *recordPtr)
1885 {
1886 Spinbox *sb = recordPtr;
1887 TtkTrackElementState(&sb->core);
1888 EntryInitialize(interp, recordPtr);
1889 }
1890
1891 /* SpinboxConfigure --
1892 * Configuration hook for spinbox widgets.
1893 */
1894 static int
1895 SpinboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
1896 {
1897 Spinbox *sb = recordPtr;
1898 int unused;
1899
1900 /* Make sure -values is a valid list:
1901 */
1902 if (Tcl_ListObjLength(interp,sb->spinbox.valuesObj,&unused) != TCL_OK)
1903 return TCL_ERROR;
1904
1905 return EntryConfigure(interp, recordPtr, mask);
1906 }
1907
1908 static WidgetCommandSpec SpinboxCommands[] = {
1909 { "bbox", EntryBBoxCommand },
1910 { "cget", TtkWidgetCgetCommand },
1911 { "configure", TtkWidgetConfigureCommand },
1912 { "delete", EntryDeleteCommand },
1913 { "get", EntryGetCommand },
1914 { "icursor", EntryICursorCommand },
1915 { "identify", TtkWidgetIdentifyCommand },
1916 { "index", EntryIndexCommand },
1917 { "insert", EntryInsertCommand },
1918 { "instate", TtkWidgetInstateCommand },
1919 { "selection", EntrySelectionCommand },
1920 { "state", TtkWidgetStateCommand },
1921 { "set", EntrySetCommand },
1922 { "validate", EntryValidateCommand },
1923 { "xview", EntryXViewCommand },
1924 {0,0}
1925 };
1926
1927 static WidgetSpec SpinboxWidgetSpec = {
1928 "TSpinbox", /* className */
1929 sizeof(Spinbox), /* recordSize */
1930 SpinboxOptionSpecs, /* optionSpecs */
1931 SpinboxCommands, /* subcommands */
1932 SpinboxInitialize, /* initializeProc */
1933 EntryCleanup, /* cleanupProc */
1934 SpinboxConfigure, /* configureProc */
1935 EntryPostConfigure, /* postConfigureProc */
1936 TtkWidgetGetLayout, /* getLayoutProc */
1937 TtkWidgetSize, /* sizeProc */
1938 EntryDoLayout, /* layoutProc */
1939 EntryDisplay /* displayProc */
1940 };
1941
1942 /*------------------------------------------------------------------------
18411943 * +++ Textarea element.
18421944 *
18431945 * Text display area for Entry widgets.
19012003 TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))
19022004 TTK_END_LAYOUT
19032005
2006 TTK_BEGIN_LAYOUT(SpinboxLayout)
2007 TTK_GROUP("Spinbox.field", TTK_PACK_TOP|TTK_FILL_X,
2008 TTK_GROUP("null", TTK_PACK_RIGHT,
2009 TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP|TTK_STICK_E)
2010 TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM|TTK_STICK_E))
2011 TTK_GROUP("Spinbox.padding", TTK_FILL_BOTH,
2012 TTK_NODE("Spinbox.textarea", TTK_FILL_BOTH)))
2013 TTK_END_LAYOUT
2014
19042015 /*------------------------------------------------------------------------
19052016 * +++ Initialization.
19062017 */
1907
19082018 MODULE_SCOPE
19092019 void TtkEntry_Init(Tcl_Interp *interp)
19102020 {
19142024
19152025 Ttk_RegisterLayout(themePtr, "TEntry", EntryLayout);
19162026 Ttk_RegisterLayout(themePtr, "TCombobox", ComboboxLayout);
2027 Ttk_RegisterLayout(themePtr, "TSpinbox", SpinboxLayout);
19172028
19182029 RegisterWidget(interp, "ttk::entry", &EntryWidgetSpec);
19192030 RegisterWidget(interp, "ttk::combobox", &ComboboxWidgetSpec);
2031 RegisterWidget(interp, "ttk::spinbox", &SpinboxWidgetSpec);
19202032 }
19212033
19222034 /*EOF*/
0 /* $Id: ttkFrame.c,v 1.12 2008/01/08 20:02:27 jenglish Exp $
0 /* $Id: ttkFrame.c,v 1.13 2008/11/09 23:53:09 jenglish Exp $
11 * Copyright (c) 2004, Joe English
22 *
33 * ttk::frame and ttk::labelframe widgets.
514514 /* LabelframeInitialize --
515515 * Initialization hook.
516516 */
517 static int LabelframeInitialize(Tcl_Interp *interp, void *recordPtr)
517 static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr)
518518 {
519519 Labelframe *lframe = recordPtr;
520520
523523 lframe->label.labelWidget = 0;
524524 lframe->label.labelLayout = 0;
525525 lframe->label.labelParcel = Ttk_MakeBox(-1,-1,-1,-1);
526
527 return TCL_OK;
528526 }
529527
530528 /* LabelframeCleanup --
77 # See the file "license.terms" for information on usage and redistribution
88 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 #
10 # $Id: ttkGenStubs.tcl,v 1.1 2007/03/07 23:46:34 das Exp $
10 # $Id: ttkGenStubs.tcl,v 1.2 2008/10/22 20:56:43 nijtmans Exp $
1111 #
1212 # SOURCE: tcl/tools/genStubs.tcl, revision 1.20
1313 #
433433 [lindex $arg 2]
434434 if {[string length $line] + [string length $next] \
435435 + $pad > 76} {
436 append text $line \n
436 append text [string trimright $line] \n
437437 set line "\t\t\t\t"
438438 set pad 28
439439 }
451451 [lindex $arg 2]
452452 if {[string length $line] + [string length $next] \
453453 + $pad > 76} {
454 append text $line \n
454 append text [string trimright $line] \n
455455 set line "\t\t\t\t"
456456 set pad 28
457457 }
875875 if {[string length [namespace which lassign]] == 0} {
876876 proc lassign {valueList args} {
877877 if {[llength $args] == 0} {
878 error "wrong # args: lassign list varname ?varname..?"
878 error "wrong # args: should be \"lassign list ?varName ...?\""
879879 }
880880
881881 uplevel [list foreach $args $valueList {break}]
44 *
55 * Copyright (c) 2003 Joe English. Freely redistributable.
66 *
7 * $Id: ttkLayout.c,v 1.12 2008/05/23 20:20:05 jenglish Exp $
7 * $Id: ttkLayout.c,v 1.13 2008/12/07 16:34:56 das Exp $
88 */
99
1010 #include <string.h>
732732 last = node;
733733 }
734734
735 if (spec->opcode & _TTK_CHILDREN) {
735 if (spec->opcode & _TTK_CHILDREN && last) {
736736 int depth = 1;
737737 last->child = Ttk_BuildLayoutTemplate(spec+1);
738738
0 /* $Id: ttkNotebook.c,v 1.15 2008/07/23 23:24:45 nijtmans Exp $
0 /* $Id: ttkNotebook.c,v 1.16 2008/11/09 23:53:09 jenglish Exp $
11 * Copyright (c) 2004, Joe English
22 */
33
12131213 * +++ Widget class hooks.
12141214 */
12151215
1216 static int NotebookInitialize(Tcl_Interp *interp, void *recordPtr)
1216 static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr)
12171217 {
12181218 Notebook *nb = recordPtr;
12191219
12311231
12321232 Tk_CreateEventHandler(
12331233 nb->core.tkwin, NotebookEventMask, NotebookEventHandler, recordPtr);
1234
1235 return TCL_OK;
12361234 }
12371235
12381236 static void NotebookCleanup(void *recordPtr)
0 /* $Id: ttkPanedwindow.c,v 1.16 2008/07/23 23:24:45 nijtmans Exp $
0 /* $Id: ttkPanedwindow.c,v 1.17 2008/11/09 23:53:09 jenglish Exp $
11 *
22 * Copyright (c) 2005, Joe English. Freely redistributable.
33 *
492492 * +++ Initialization and cleanup hooks.
493493 */
494494
495 static int PanedInitialize(Tcl_Interp *interp, void *recordPtr)
495 static void PanedInitialize(Tcl_Interp *interp, void *recordPtr)
496496 {
497497 Paned *pw = recordPtr;
498498
502502 pw->paned.paneOptionTable = Tk_CreateOptionTable(interp,PaneOptionSpecs);
503503 pw->paned.sashLayout = 0;
504504 pw->paned.sashThickness = 1;
505
506 return TCL_OK;
507505 }
508506
509507 static void PanedCleanup(void *recordPtr)
0 /* $Id: ttkProgress.c,v 1.6 2008/04/27 22:41:12 dkf Exp $
0 /* $Id: ttkProgress.c,v 1.7 2008/11/09 23:53:09 jenglish Exp $
11 *
22 * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham
33 *
184184 * +++ Widget class methods:
185185 */
186186
187 static int ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr)
187 static void ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr)
188188 {
189189 Progressbar *pb = recordPtr;
190190 pb->progress.variableTrace = 0;
191191 pb->progress.timer = 0;
192 return TCL_OK;
193192 }
194193
195194 static void ProgressbarCleanup(void *recordPtr)
0 /* $Id: ttkScale.c,v 1.8 2008/04/27 22:41:12 dkf Exp $
0 /* $Id: ttkScale.c,v 1.9 2008/11/09 23:53:09 jenglish Exp $
11 * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
22 *
33 * ttk::scale widget.
9999 /* ScaleInitialize --
100100 * Scale widget initialization hook.
101101 */
102 static int ScaleInitialize(Tcl_Interp *interp, void *recordPtr)
102 static void ScaleInitialize(Tcl_Interp *interp, void *recordPtr)
103103 {
104104 Scale *scalePtr = recordPtr;
105
106105 TtkTrackElementState(&scalePtr->core);
107 return TCL_OK;
108106 }
109107
110108 static void ScaleCleanup(void *recordPtr)
0 /* $Id: ttkScrollbar.c,v 1.8 2008/04/27 22:41:12 dkf Exp $
0 /* $Id: ttkScrollbar.c,v 1.9 2008/11/09 23:53:09 jenglish Exp $
11 * Copyright (c) 2003, Joe English
22 *
33 * ttk::scrollbar widget.
4848 * +++ Widget hooks.
4949 */
5050
51 static int
51 static void
5252 ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr)
5353 {
5454 Scrollbar *sb = recordPtr;
5656 sb->scrollbar.last = 1.0;
5757
5858 TtkTrackElementState(&sb->core);
59
60 return TCL_OK;
6159 }
6260
6361 static Ttk_Layout ScrollbarGetLayout(
00 /*
1 * $Id: ttkState.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $
1 * $Id: ttkState.c,v 1.3 2008/12/03 18:44:49 jenglish Exp $
22 *
33 * Tk widget state utilities.
44 *
1515 * Table of state names. Must be kept in sync with TTK_STATE_*
1616 * #defines in ttkTheme.h.
1717 */
18 static const char *stateNames[] =
18 static const char *const stateNames[] =
1919 {
2020 "active", /* Mouse cursor is over widget or element */
2121 "disabled", /* Widget is disabled */
2626 "alternate", /* Widget-specific alternate display style */
2727 "invalid", /* Bad value */
2828 "readonly", /* Editing/modification disabled */
29 "hover", /* Mouse cursor is over widget */
30 "reserved1", /* Reserved for future extension */
31 "reserved2", /* Reserved for future extension */
32 "reserved3", /* Reserved for future extension */
33 "user3", /* User-definable state */
34 "user2", /* User-definable state */
35 "user1", /* User-definable state */
2936 NULL
3037 };
3138
218225
219226 /* Ttk_GetStateMapFromObj --
220227 * Returns a Ttk_StateMap from a Tcl_Obj*.
221 * Since a Ttk_StateMap is just a specially-formatted Tcl_Obj,
228 * Since a Ttk_StateMap is just a specially-formatted Tcl_Obj,
222229 * this basically just checks for errors.
223230 */
224231 Ttk_StateMap Ttk_GetStateMapFromObj(
88 * See the file "license.terms" for information on usage and redistribution
99 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * $Id: ttkTheme.c,v 1.15 2008/07/23 23:24:45 nijtmans Exp $
11 * $Id: ttkTheme.c,v 1.16 2008/10/24 20:01:10 jenglish Exp $
1212 */
1313
1414 #include <stdlib.h>
1515 #include <string.h>
1616 #include <tk.h>
17 #include <tkInt.h>
1718 #include "ttkThemeInt.h"
1819
19 #ifdef NO_PRIVATE_HEADERS
20 EXTERN const Tk_OptionSpec *TkGetOptionSpec(const char *name,
21 Tk_OptionTable optionTable);
22 #else
23 #include <tkInt.h>
24 #endif
20 #define PKG_ASSOC_KEY "Ttk"
2521
2622 /*------------------------------------------------------------------------
2723 * +++ Styles.
474470
475471 static StylePackageData *GetStylePackageData(Tcl_Interp *interp)
476472 {
477 return (StylePackageData*)Tcl_GetAssocData(interp, "StylePackage", NULL);
473 return Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL);
478474 }
479475
480476 /*
17071703 pkgPtr->cache = Ttk_CreateResourceCache(interp);
17081704 pkgPtr->themeChangePending = 0;
17091705
1710 Tcl_SetAssocData(interp, "StylePackage", Ttk_StylePkgFree,
1711 (ClientData)pkgPtr);
1706 Tcl_SetAssocData(interp, PKG_ASSOC_KEY, Ttk_StylePkgFree, pkgPtr);
17121707
17131708 /*
17141709 * Create the default system theme:
0 /* $Id: ttkTheme.h,v 1.14 2008/05/23 20:20:05 jenglish Exp $
0 /* $Id: ttkTheme.h,v 1.16 2008/12/03 18:44:49 jenglish Exp $
11 * Copyright (c) 2003 Joe English. Freely redistributable.
22 *
33 * Declarations for Tk theme engine.
4747 #define TTK_STATE_ALTERNATE (1<<6)
4848 #define TTK_STATE_INVALID (1<<7)
4949 #define TTK_STATE_READONLY (1<<8)
50 #define TTK_STATE_USER7 (1<<9)
50 #define TTK_STATE_HOVER (1<<9)
5151 #define TTK_STATE_USER6 (1<<10)
5252 #define TTK_STATE_USER5 (1<<11)
5353 #define TTK_STATE_USER4 (1<<12)
235235
236236 typedef struct Ttk_ElementOptionSpec
237237 {
238 char *optionName; /* Command-line name of the widget option */
238 const char *optionName; /* Command-line name of the widget option */
239239 Tk_OptionType type; /* Accepted option types */
240240 int offset; /* Offset of Tcl_Obj* field in element record */
241 char *defaultValue; /* Default value to used if resource missing */
241 const char *defaultValue; /* Default value to used if resource missing */
242242 } Ttk_ElementOptionSpec;
243243
244244 #define TK_OPTION_ANY TK_OPTION_STRING
0 /* $Id: ttkTreeview.c,v 1.29 2008/07/23 23:24:45 nijtmans Exp $
0 /* $Id: ttkTreeview.c,v 1.30 2008/11/09 23:53:09 jenglish Exp $
11 * Copyright (c) 2004, Joe English
22 *
33 * ttk::treeview widget implementation.
984984 * +++ Initialization and cleanup.
985985 */
986986
987 static int TreeviewInitialize(Tcl_Interp *interp, void *recordPtr)
987 static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr)
988988 {
989989 Treeview *tv = recordPtr;
990990 int unused;
10491049 */
10501050 tv->tree.treeArea = tv->tree.headingArea = Ttk_MakeBox(0,0,0,0);
10511051 tv->tree.slack = 0;
1052
1053 return TCL_OK;
10541052 }
10551053
10561054 static void TreeviewCleanup(void *recordPtr)
0 /* $Id: ttkWidget.c,v 1.13 2008/07/23 23:24:44 nijtmans Exp $
0 /* $Id: ttkWidget.c,v 1.20 2008/12/03 18:44:50 jenglish Exp $
11 * Copyright (c) 2003, Joe English
22 *
33 * Core widget utilities.
6060 static Drawable BeginDrawing(Tk_Window tkwin)
6161 {
6262 return Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
63 Tk_Width(tkwin), Tk_Height(tkwin),
64 DefaultDepthOfScreen(Tk_Screen(tkwin)));
63 Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
6564 }
6665
6766 /* EndDrawing --
115114 }
116115
117116 if (!(corePtr->flags & REDISPLAY_PENDING)) {
118 Tcl_DoWhenIdle(DrawWidget, (ClientData) corePtr);
117 Tcl_DoWhenIdle(DrawWidget, corePtr);
119118 corePtr->flags |= REDISPLAY_PENDING;
120119 }
121120 }
170169 return commands[index].command(interp, objc, objv, clientData);
171170 }
172171
173 /*
174 * WidgetInstanceObjCmd --
172 /* WidgetInstanceObjCmd --
175173 * Widget instance command implementation.
176174 */
177175 static int
178176 WidgetInstanceObjCmd(
179 ClientData clientData, /* Widget record pointer */
180 Tcl_Interp *interp, /* Current interpreter. */
181 int objc, /* Number of arguments. */
182 Tcl_Obj *const objv[]) /* Argument objects. */
183 {
184 WidgetCore *corePtr = (WidgetCore *)clientData;
177 ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
178 {
179 WidgetCore *corePtr = clientData;
185180 const WidgetCommandSpec *commands = corePtr->widgetSpec->commands;
186 int status = TCL_OK;
181 int status;
187182
188183 Tcl_Preserve(clientData);
189184 status = TtkWidgetEnsembleCommand(commands,1, interp,objc,objv,clientData);
192187 return status;
193188 }
194189
195 /*
196 * Command deletion callback for widget instance commands.
190 /*------------------------------------------------------------------------
191 * +++ Widget destruction.
192 *
193 * A widget can be destroyed when the application explicitly
194 * destroys the window or one of its ancestors via [destroy]
195 * or Tk_DestroyWindow(); when the application deletes the widget
196 * instance command; when there is an error in the widget constructor;
197 * or when another application calls XDestroyWindow on the window ID.
198 *
199 * The window receives a <DestroyNotify> event in all cases,
200 * so we do the bulk of the cleanup there. See [#2207435] for
201 * further notes (esp. re: Tk_FreeConfigOptions).
202 *
203 * Widget code that reenters the interp should only do so
204 * when the widtget is Tcl_Preserve()d, and should check
205 * the WIDGET_DESTROYED flag bit upon return.
206 */
207
208 /* WidgetInstanceObjCmdDeleted --
209 * Widget instance command deletion callback.
197210 */
198211 static void
199212 WidgetInstanceObjCmdDeleted(ClientData clientData)
200213 {
201 WidgetCore *corePtr = (WidgetCore *) clientData;
214 WidgetCore *corePtr = clientData;
202215 corePtr->widgetCmd = NULL;
203216 if (corePtr->tkwin != NULL)
204217 Tk_DestroyWindow(corePtr->tkwin);
205218 }
206219
207 /*
208 * WidgetCleanup --
209 * Final cleanup for widget.
210 *
211 * @@@ TODO: check all code paths leading to widget destruction,
212 * @@@ describe here.
213 * @@@ Call widget-specific cleanup routine at an appropriate point.
220 /* FreeWidget --
221 * Final cleanup for widget; called via Tcl_EventuallyFree().
214222 */
215223 static void
216 WidgetCleanup(char *memPtr)
224 FreeWidget(char *memPtr)
217225 {
218226 ckfree(memPtr);
227 }
228
229 /* DestroyWidget --
230 * Main widget destructor; called from <DestroyNotify> event handler.
231 */
232 static void
233 DestroyWidget(WidgetCore *corePtr)
234 {
235 corePtr->flags |= WIDGET_DESTROYED;
236
237 corePtr->widgetSpec->cleanupProc(corePtr);
238
239 Tk_FreeConfigOptions(
240 (ClientData)corePtr, corePtr->optionTable, corePtr->tkwin);
241
242 if (corePtr->layout) {
243 Ttk_FreeLayout(corePtr->layout);
244 }
245
246 if (corePtr->flags & REDISPLAY_PENDING) {
247 Tcl_CancelIdleCall(DrawWidget, corePtr);
248 }
249
250 corePtr->tkwin = NULL;
251 if (corePtr->widgetCmd) {
252 Tcl_Command cmd = corePtr->widgetCmd;
253 corePtr->widgetCmd = 0;
254 /* NB: this can reenter the interpreter via a command traces */
255 Tcl_DeleteCommandFromToken(corePtr->interp, cmd);
256 }
257 Tcl_EventuallyFree(corePtr, FreeWidget);
219258 }
220259
221260 /*
241280 | FocusChangeMask
242281 | VirtualEventMask
243282 | ActivateMask
283 | EnterWindowMask
284 | LeaveWindowMask
244285 ;
245286
246287 static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
247288 {
248 WidgetCore *corePtr = (WidgetCore *) clientData;
289 WidgetCore *corePtr = clientData;
249290
250291 switch (eventPtr->type)
251292 {
258299 }
259300 break;
260301 case DestroyNotify :
261 corePtr->flags |= WIDGET_DESTROYED;
262
263 Tk_DeleteEventHandler(corePtr->tkwin,
264 CoreEventMask,CoreEventProc,clientData);
265
266 if (corePtr->flags & REDISPLAY_PENDING) {
267 Tcl_CancelIdleCall(DrawWidget, clientData);
268 }
269
270 corePtr->widgetSpec->cleanupProc(corePtr);
271
272 Tk_FreeConfigOptions(
273 clientData, corePtr->optionTable, corePtr->tkwin);
274 corePtr->tkwin = NULL;
275
276 if (corePtr->layout) {
277 Ttk_FreeLayout(corePtr->layout);
278 }
279
280 /* NB: this can reenter the interpreter via a command traces */
281 if (corePtr->widgetCmd) {
282 Tcl_Command cmd = corePtr->widgetCmd;
283 corePtr->widgetCmd = 0;
284 Tcl_DeleteCommandFromToken(corePtr->interp, cmd);
285 }
286 Tcl_EventuallyFree(clientData, WidgetCleanup);
287 break;
288
302 Tk_DeleteEventHandler(
303 corePtr->tkwin, CoreEventMask,CoreEventProc,clientData);
304 DestroyWidget(corePtr);
305 break;
289306 case FocusIn:
290307 case FocusOut:
291308 /* Don't process "virtual crossing" events */
308325 corePtr->state |= TTK_STATE_BACKGROUND;
309326 TtkRedisplayWidget(corePtr);
310327 break;
328 case LeaveNotify:
329 corePtr->state &= ~TTK_STATE_HOVER;
330 TtkRedisplayWidget(corePtr);
331 break;
332 case EnterNotify:
333 corePtr->state |= TTK_STATE_HOVER;
334 TtkRedisplayWidget(corePtr);
335 break;
311336 case VirtualEvent:
312337 if (!strcmp("ThemeChanged", ((XVirtualEvent *)(eventPtr))->name)) {
313338 (void)UpdateLayout(corePtr->interp, corePtr);
328353 */
329354 static void WidgetWorldChanged(ClientData clientData)
330355 {
331 WidgetCore *corePtr = (WidgetCore*)clientData;
356 WidgetCore *corePtr = clientData;
332357 SizeChanged(corePtr);
333358 TtkRedisplayWidget(corePtr);
334359 }
346371 int TtkWidgetConstructorObjCmd(
347372 ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
348373 {
349 WidgetSpec *widgetSpec = (WidgetSpec *)clientData;
374 WidgetSpec *widgetSpec = clientData;
350375 const char *className = widgetSpec->className;
376 Tk_OptionTable optionTable =
377 Tk_CreateOptionTable(interp, widgetSpec->optionSpecs);
378 Tk_Window tkwin;
379 void *recordPtr;
351380 WidgetCore *corePtr;
352 ClientData recordPtr;
353 Tk_Window tkwin;
354 Tk_OptionTable optionTable;
381 Tk_SavedOptions savedOptions;
355382 int i;
356383
357 if (objc < 2 || objc % 1 == 1) {
384 if (objc < 2 || objc % 2 == 1) {
358385 Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
359386 return TCL_ERROR;
360387 }
361388
362 tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
363 Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL);
364 if (tkwin == NULL)
365 return TCL_ERROR;
366
367 /*
368 * Check if a -class resource has been specified:
389 /* Check if a -class option has been specified.
369390 * We have to do this before the InitOptions() call,
370391 * since InitOptions() is affected by the widget class.
371392 */
372393 for (i = 2; i < objc; i += 2) {
373 const char *resourceName = Tcl_GetString(objv[i]);
374 if (!strcmp(resourceName, "-class")) {
394 if (!strcmp(Tcl_GetString(objv[i]), "-class")) {
375395 className = Tcl_GetString(objv[i+1]);
376396 break;
377397 }
378398 }
379399
380 Tk_SetClass(tkwin, className);
381
382 /*
383 * Set the BackgroundPixmap to ParentRelative here, so
384 * subclasses don't need to worry about setting the background.
385 */
386 Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative);
387
388 optionTable = Tk_CreateOptionTable(interp, widgetSpec->optionSpecs);
400 tkwin = Tk_CreateWindowFromPath(
401 interp, Tk_MainWindow(interp), Tcl_GetString(objv[1]), NULL);
402 if (tkwin == NULL)
403 return TCL_ERROR;
389404
390405 /*
391406 * Allocate and initialize the widget record.
392407 */
393408 recordPtr = ckalloc(widgetSpec->recordSize);
394409 memset(recordPtr, 0, widgetSpec->recordSize);
395 corePtr = (WidgetCore *)recordPtr;
410 corePtr = recordPtr;
396411
397412 corePtr->tkwin = tkwin;
398413 corePtr->interp = interp;
400415 corePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin),
401416 WidgetInstanceObjCmd, recordPtr, WidgetInstanceObjCmdDeleted);
402417 corePtr->optionTable = optionTable;
403
418 corePtr->layout = NULL;
419 corePtr->flags = 0;
420 corePtr->state = 0;
421
422 Tk_SetClass(tkwin, className);
404423 Tk_SetClassProcs(tkwin, &widgetClassProcs, recordPtr);
405
406 if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK)
407 goto error_nocleanup;
408
409 if (widgetSpec->initializeProc(interp, recordPtr) != TCL_OK)
410 goto error_nocleanup;
411
412 if (Tk_SetOptions(interp, recordPtr, optionTable, objc - 2,
413 objv + 2, tkwin, NULL/*savePtr*/, (int *)NULL/*maskPtr*/) != TCL_OK)
424 Tk_SetWindowBackgroundPixmap(tkwin, ParentRelative);
425
426 widgetSpec->initializeProc(interp, recordPtr);
427
428 Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr);
429
430 /*
431 * Initial configuration.
432 */
433
434 Tcl_Preserve(corePtr);
435 if (Tk_InitOptions(interp, recordPtr, optionTable, tkwin) != TCL_OK) {
414436 goto error;
415
437 }
438
439 if (Tk_SetOptions(interp, recordPtr, optionTable,
440 objc - 2, objv + 2, tkwin, &savedOptions, NULL) != TCL_OK) {
441 Tk_RestoreSavedOptions(&savedOptions);
442 goto error;
443 } else {
444 Tk_FreeSavedOptions(&savedOptions);
445 }
416446 if (widgetSpec->configureProc(interp, recordPtr, ~0) != TCL_OK)
417447 goto error;
418
419448 if (widgetSpec->postConfigureProc(interp, recordPtr, ~0) != TCL_OK)
420449 goto error;
421450
422451 if (WidgetDestroyed(corePtr))
423452 goto error;
424453
425 if (UpdateLayout(interp, corePtr) != TCL_OK)
426 goto error;
454 Tcl_Release(corePtr);
427455
428456 SizeChanged(corePtr);
429 Tk_CreateEventHandler(tkwin, CoreEventMask, CoreEventProc, recordPtr);
430
431457 Tk_MakeWindowExist(tkwin);
432458
433459 Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), -1));
434
435460 return TCL_OK;
436461
437462 error:
438 widgetSpec->cleanupProc(recordPtr);
439 error_nocleanup:
440 if (corePtr->layout) {
441 Ttk_FreeLayout(corePtr->layout);
442 corePtr->layout = 0;
443 }
444 Tk_FreeConfigOptions(recordPtr, optionTable, tkwin);
445 Tk_DestroyWindow(tkwin);
446 corePtr->tkwin = 0;
447 Tcl_DeleteCommandFromToken(interp, corePtr->widgetCmd);
448 ckfree(recordPtr);
463 if (WidgetDestroyed(corePtr)) {
464 Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
465 } else {
466 Tk_DestroyWindow(tkwin);
467 }
468 Tcl_Release(corePtr);
449469 return TCL_ERROR;
450470 }
451471
521541 /* TtkNullInitialize --
522542 * Default widget initializeProc (no-op)
523543 */
524 int TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
525 {
526 return TCL_OK;
544 void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr)
545 {
527546 }
528547
529548 /* TtkNullPostConfigure --
620639
621640 if (objc == 2) {
622641 result = Tk_GetOptionInfo(interp, recordPtr,
623 corePtr->optionTable, (Tcl_Obj *) NULL, corePtr->tkwin);
642 corePtr->optionTable, NULL, corePtr->tkwin);
624643 } else if (objc == 3) {
625644 result = Tk_GetOptionInfo(interp, recordPtr,
626645 corePtr->optionTable, objv[2], corePtr->tkwin);
650669 Tk_FreeSavedOptions(&savedOptions);
651670
652671 status = corePtr->widgetSpec->postConfigureProc(interp,recordPtr,mask);
672 if (WidgetDestroyed(corePtr)) {
673 Tcl_SetResult(interp, "Widget has been destroyed", TCL_STATIC);
674 status = TCL_ERROR;
675 }
653676 if (status != TCL_OK) {
654677 return status;
655678 }
0 /* $Id: ttkWidget.h,v 1.10 2008/05/23 20:20:05 jenglish Exp $
0 /* $Id: ttkWidget.h,v 1.11 2008/11/09 23:53:09 jenglish Exp $
11 * Copyright (c) 2003, Joe English
22 * Helper routines for widget implementations.
33 */
7474 /*
7575 * Hooks:
7676 */
77 int (*initializeProc)(Tcl_Interp *, void *recordPtr);
77 void (*initializeProc)(Tcl_Interp *, void *recordPtr);
7878 void (*cleanupProc)(void *recordPtr);
7979 int (*configureProc)(Tcl_Interp *, void *recordPtr, int flags);
8080 int (*postConfigureProc)(Tcl_Interp *, void *recordPtr, int flags);
8787 /*
8888 * Common factors for widget implementations:
8989 */
90 MODULE_SCOPE int TtkNullInitialize(Tcl_Interp *, void *);
90 MODULE_SCOPE void TtkNullInitialize(Tcl_Interp *, void *);
9191 MODULE_SCOPE int TtkNullPostConfigure(Tcl_Interp *, void *, int);
9292 MODULE_SCOPE void TtkNullCleanup(void *recordPtr);
9393 MODULE_SCOPE Ttk_Layout TtkWidgetGetLayout(
33 # can be used by non-unix systems that do not have built-in support
44 # for shells.
55 #
6 # RCS: @(#) $Id: console.tcl,v 1.38 2008/05/13 13:25:18 patthoyts Exp $
6 # RCS: @(#) $Id: console.tcl,v 1.39 2008/12/10 05:02:51 das Exp $
77 #
88 # Copyright (c) 1995-1997 Sun Microsystems, Inc.
99 # Copyright (c) 1998-2000 Ajuba Solutions.
10 # Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
10 # Copyright (c) 2007-2008 Daniel A. Steffen <das@users.sourceforge.net>
1111 #
1212 # See the file "license.terms" for information on usage and redistribution
1313 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
2121 variable magicKeys 1 ; # enable brace matching and proc/var recognition
2222 variable maxLines 600 ; # maximum # of lines buffered in console
2323 variable showMatches 1 ; # show multiple expand matches
24
24 variable useFontchooser [llength [info command ::tk::fontchooser]]
2525 variable inPlugin [info exists embed_args]
2626 variable defaultPrompt ; # default prompt if tcl_prompt1 isn't used
27
2827
2928 if {$inPlugin} {
3029 set defaultPrompt {subst {[history nextid] % }}
9796 }
9897
9998 AmpMenuArgs .menubar.edit add separator
99 if {$::tk::console::useFontchooser} {
100 if {[tk windowingsystem] eq "aqua"} {
101 .menubar.edit add command -label tk_choose_font_marker
102 set index [.menubar.edit index tk_choose_font_marker]
103 .menubar.edit entryconfigure $index \
104 -label [mc "Show Fonts"]\
105 -accelerator "$mod-T"\
106 -command [list ::tk::console::FontchooserToggle]
107 bind Console <<TkFontchooserVisibility>> \
108 [list ::tk::console::FontchooserVisibility $index]
109 ::tk::console::FontchooserVisibility $index
110 } else {
111 AmpMenuArgs .menubar.edit add command -label [mc "&Font..."] \
112 -command [list ::tk::console::FontchooserToggle]
113 }
114 bind Console <FocusIn> [list ::tk::console::FontchooserFocus %W 1]
115 bind Console <FocusOut> [list ::tk::console::FontchooserFocus %W 0]
116 }
100117 AmpMenuArgs .menubar.edit add command -label [mc "&Increase Font Size"] \
101118 -accel "$mod++" -command {event generate .console <<Console_FontSizeIncr>>}
102119 AmpMenuArgs .menubar.edit add command -label [mc "&Decrease Font Size"] \
395412 event add $ev $key
396413 bind Console $key {}
397414 }
415 if {$::tk::console::useFontchooser} {
416 bind Console <Command-Key-t> [list ::tk::console::FontchooserToggle]
417 }
398418 }
399419 bind Console <<Console_Expand>> {
400420 if {[%W compare insert > promptEnd]} {
556576 if {$size < 0} {set sign -1} else {set sign 1}
557577 set size [expr {(abs($size) + 1) * $sign}]
558578 font configure TkConsoleFont -size $size
579 if {$::tk::console::useFontchooser} {
580 tk fontchooser configure -font TkConsoleFont
581 }
559582 }
560583 bind Console <<Console_FontSizeDecr>> {
561584 set size [font configure TkConsoleFont -size]
563586 if {$size < 0} {set sign -1} else {set sign 1}
564587 set size [expr {(abs($size) - 1) * $sign}]
565588 font configure TkConsoleFont -size $size
589 if {$::tk::console::useFontchooser} {
590 tk fontchooser configure -font TkConsoleFont
591 }
566592 }
567593
568594 ##
666692
667693 Tcl $::tcl_patchLevel
668694 Tk $::tk_patchLevel"
695 }
696
697 # ::tk::console::Fontchooser* --
698 # Let the user select the console font (TIP 324).
699
700 proc ::tk::console::FontchooserToggle {} {
701 if {[tk fontchooser configure -visible]} {
702 tk fontchooser hide
703 } else {
704 tk fontchooser show
705 }
706 }
707 proc ::tk::console::FontchooserVisibility {index} {
708 if {[tk fontchooser configure -visible]} {
709 .menubar.edit entryconfigure $index -label [msgcat::mc "Hide Fonts"]
710 } else {
711 .menubar.edit entryconfigure $index -label [msgcat::mc "Show Fonts"]
712 }
713 }
714 proc ::tk::console::FontchooserFocus {w isFocusIn} {
715 if {$isFocusIn} {
716 tk fontchooser configure -parent $w -font TkConsoleFont \
717 -command [namespace code [list FontchooserApply]]
718 } else {
719 tk fontchooser configure -parent $w -font {} -command {}
720 }
721 }
722 proc ::tk::console::FontchooserApply {font args} {
723 catch {font configure TkConsoleFont {*}[font actual $font]}
669724 }
670725
671726 # ::tk::console::TagProc --
11 #
22 # This demonstration script creates several combobox widgets.
33 #
4 # RCS: @(#) $Id: combo.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
4 # RCS: @(#) $Id: combo.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
55
66 if {![info exists widgetDemo]} {
77 error "This script should be run from the \"widget\" demo."
88 }
99
1010 package require Tk
11 package require Ttk
1211
1312 set w .combo
1413 catch {destroy $w}
22 # This demonstration script creates a canvas widget with a text
33 # item that can be edited and reconfigured in various ways.
44 #
5 # RCS: @(#) $Id: ctext.tcl,v 1.5 2004/12/21 11:56:35 dkf Exp $
5 # RCS: @(#) $Id: ctext.tcl,v 1.6 2008/11/22 23:03:20 dkf Exp $
66
77 if {![info exists widgetDemo]} {
88 error "This script should be run from the \"widget\" demo."
1818 positionWindow $w
1919 set c $w.c
2020
21 label $w.msg -font $font -wraplength 5i -justify left -text "This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing:
21 label $w.msg -font $font -wraplength 5i -justify left -text "This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification, and on a pie slice to change its angle. The text also supports the following simple bindings for editing:
2222 1. You can point, click, and type.
2323 2. You can also select with button 1.
2424 3. You can copy the selection to the mouse position with button 2.
5151 $c bind text <Control-h> "textBs $c"
5252 $c bind text <BackSpace> "textBs $c"
5353 $c bind text <Delete> "textDel $c"
54 $c bind text <2> "textPaste $c @%x,%y"
54 $c bind text <2> "textPaste $c @%x,%y"
5555
5656 # Next, create some items that allow the text's anchor position
5757 # to be edited.
5858
59 proc mkTextConfig {w x y option value color} {
59 proc mkTextConfigBox {w x y option value color} {
6060 set item [$w create rect $x $y [expr {$x+30}] [expr {$y+30}] \
6161 -outline black -fill $color -width 1]
62 $w bind $item <1> "$w itemconf text $option $value"
63 $w addtag config withtag $item
64 }
65 proc mkTextConfigPie {w x y a option value color} {
66 set item [$w create arc $x $y [expr {$x+90}] [expr {$y+90}] \
67 -start [expr {$a-15}] -extent 30 -outline black -fill $color \
68 -width 1]
6269 $w bind $item <1> "$w itemconf text $option $value"
6370 $w addtag config withtag $item
6471 }
6673 set x 50
6774 set y 50
6875 set color LightSkyBlue1
69 mkTextConfig $c $x $y -anchor se $color
70 mkTextConfig $c [expr {$x+30}] [expr {$y }] -anchor s $color
71 mkTextConfig $c [expr {$x+60}] [expr {$y }] -anchor sw $color
72 mkTextConfig $c [expr {$x }] [expr {$y+30}] -anchor e $color
73 mkTextConfig $c [expr {$x+30}] [expr {$y+30}] -anchor center $color
74 mkTextConfig $c [expr {$x+60}] [expr {$y+30}] -anchor w $color
75 mkTextConfig $c [expr {$x }] [expr {$y+60}] -anchor ne $color
76 mkTextConfig $c [expr {$x+30}] [expr {$y+60}] -anchor n $color
77 mkTextConfig $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
76 mkTextConfigBox $c $x $y -anchor se $color
77 mkTextConfigBox $c [expr {$x+30}] [expr {$y }] -anchor s $color
78 mkTextConfigBox $c [expr {$x+60}] [expr {$y }] -anchor sw $color
79 mkTextConfigBox $c [expr {$x }] [expr {$y+30}] -anchor e $color
80 mkTextConfigBox $c [expr {$x+30}] [expr {$y+30}] -anchor center $color
81 mkTextConfigBox $c [expr {$x+60}] [expr {$y+30}] -anchor w $color
82 mkTextConfigBox $c [expr {$x }] [expr {$y+60}] -anchor ne $color
83 mkTextConfigBox $c [expr {$x+30}] [expr {$y+60}] -anchor n $color
84 mkTextConfigBox $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
7885 set item [$c create rect \
7986 [expr {$x+40}] [expr {$y+40}] [expr {$x+50}] [expr {$y+50}] \
8087 -outline black -fill red]
8188 $c bind $item <1> "$c itemconf text -anchor center"
8289 $c create text [expr {$x+45}] [expr {$y-5}] \
83 -text {Text Position} -anchor s -font {Times 24} -fill brown
90 -text {Text Position} -anchor s -font {Times 20} -fill brown
91
92 # Now create some items that allow the text's angle to be changed.
93
94 set x 205
95 set y 50
96 set color Yellow
97 mkTextConfigPie $c $x $y 0 -angle 90 $color
98 mkTextConfigPie $c $x $y 30 -angle 120 $color
99 mkTextConfigPie $c $x $y 60 -angle 150 $color
100 mkTextConfigPie $c $x $y 90 -angle 180 $color
101 mkTextConfigPie $c $x $y 120 -angle 210 $color
102 mkTextConfigPie $c $x $y 150 -angle 240 $color
103 mkTextConfigPie $c $x $y 180 -angle 270 $color
104 mkTextConfigPie $c $x $y 210 -angle 300 $color
105 mkTextConfigPie $c $x $y 240 -angle 330 $color
106 mkTextConfigPie $c $x $y 270 -angle 0 $color
107 mkTextConfigPie $c $x $y 300 -angle 30 $color
108 mkTextConfigPie $c $x $y 330 -angle 60 $color
109 $c create text [expr {$x+45}] [expr {$y-5}] \
110 -text {Text Angle} -anchor s -font {Times 20} -fill brown
84111
85112 # Lastly, create some items that allow the text's justification to be
86113 # changed.
88115 set x 350
89116 set y 50
90117 set color SeaGreen2
91 mkTextConfig $c $x $y -justify left $color
92 mkTextConfig $c [expr {$x+30}] $y -justify center $color
93 mkTextConfig $c [expr {$x+60}] $y -justify right $color
118 mkTextConfigBox $c $x $y -justify left $color
119 mkTextConfigBox $c [expr {$x+30}] $y -justify center $color
120 mkTextConfigBox $c [expr {$x+60}] $y -justify right $color
94121 $c create text [expr {$x+45}] [expr {$y-5}] \
95 -text {Justification} -anchor s -font {Times 24} -fill brown
122 -text {Justification} -anchor s -font {Times 20} -fill brown
96123
97124 $c bind config <Enter> "textEnter $c"
98125 $c bind config <Leave> "$c itemconf current -fill \$textConfigFill"
0 # fontchoose.tcl --
1 #
2 # Show off the stock font selector dialog
3 #
4 # RCS: @(#) $Id: fontchoose.tcl,v 1.1 2008/12/12 02:02:35 patthoyts Exp $
5
6 if {![info exists widgetDemo]} {
7 error "This script should be run from the \"widget\" demo."
8 }
9
10 package require Tk
11
12 set w .fontchoice
13 catch {destroy $w}
14 toplevel $w
15 wm title $w "Font Selection Dialog"
16 wm iconname $w "fontchooser"
17 positionWindow $w
18
19 catch {font create FontchooseDemoFont {*}[font actual TkDefaultFont]}
20
21 # The font chooser needs to be configured and then shown.
22 proc SelectFont {parent} {
23 tk fontchooser configure -font FontchooseDemoFont \
24 -command ApplyFont -parent $parent
25 tk fontchooser show
26 }
27
28 proc ApplyFont {font} {
29 font configure FontchooseDemoFont {*}[font actual $font]
30 }
31
32 # When the visibility of the fontchooser changes, the following event is fired
33 # to the parent widget.
34 #
35 bind $w <<TkFontchooserVisibility>> {
36 if {[tk fontchooser configure -visible]} {
37 %W.f.font state disabled
38 } else {
39 %W.f.font state !disabled
40 }
41 }
42
43
44 set f [ttk::frame $w.f -relief sunken -padding 2]
45
46 text $f.msg -font FontchooseDemoFont -width 40 -height 6 -borderwidth 0 \
47 -yscrollcommand [list $f.vs set]
48 ttk::scrollbar $f.vs -command [list $f.msg yview]
49
50 $f.msg insert end "Press the buttons below to choose a new font for the\
51 text shown in this window.\n" {}
52
53 ttk::button $f.font -text "Set font ..." -command [list SelectFont $w]
54
55 grid $f.msg $f.vs -sticky news
56 grid $f.font - -sticky e
57 grid columnconfigure $f 0 -weight 1
58 grid rowconfigure $f 0 -weight 1
59 bind $w <Visibility> {
60 bind %W <Visibility> {}
61 grid propagate %W.f 0
62 }
63
64 ## See Code / Dismiss buttons
65 set btns [addSeeDismiss $w.buttons $w]
66
67 grid $f -sticky news
68 grid $btns -sticky ew
69 grid columnconfigure $w 0 -weight 1
70 grid rowconfigure $w 0 -weight 1
22 # This demonstration script creates a canvas that displays the
33 # canvas item types.
44 #
5 # RCS: @(#) $Id: items.tcl,v 1.7 2004/12/21 11:56:35 dkf Exp $
5 # RCS: @(#) $Id: items.tcl,v 1.9 2008/11/22 22:38:52 dkf Exp $
66
77 if {![info exists widgetDemo]} {
88 error "This script should be run from the \"widget\" demo."
127127 -text "Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge." \
128128 -justify center -tags item
129129 $c create rectangle 24.9c 13.9c 25.1c 14.1c
130 $c create text 25c 14c -font $font2 -anchor c -fill $red -stipple gray50 \
131 -text "Stippled characters" -tags item
130 $c create text 25c 14c -font $font2 -anchor c -fill $red -angle 15 \
131 -text "Angled characters" -tags item
132132
133133 $c create text 5c 16.2c -text Arcs -anchor n
134134 $c create arc 0.5c 17c 7c 20c -fill $green -outline black \
22 # This demonstration script creates a toplevel window containing a Ttk
33 # tree widget configured as a multi-column listbox.
44 #
5 # RCS: @(#) $Id: mclist.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
5 # RCS: @(#) $Id: mclist.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
66
77 if {![info exists widgetDemo]} {
88 error "This script should be run from the \"widget\" demo."
99 }
1010
1111 package require Tk
12 package require Ttk
1312
1413 set w .mclist
1514 catch {destroy $w}
2827 ttk::frame $w.container
2928 ttk::treeview $w.tree -columns {country capital currency} -show headings \
3029 -yscroll "$w.vsb set" -xscroll "$w.hsb set"
31 if {[tk windowingsystem] ne "aqua"} {
32 ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
33 ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
34 } else {
35 scrollbar $w.vsb -orient vertical -command "$w.tree yview"
36 scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
37 }
30 ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
31 ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
3832 pack $w.container -fill both -expand 1
3933 grid $w.tree $w.vsb -in $w.container -sticky nsew
4034 grid $w.hsb -in $w.container -sticky nsew
11 #
22 # This demonstration script creates message boxes of various type
33 #
4 # RCS: @(#) $Id: msgbox.tcl,v 1.6 2007/12/13 15:27:07 dgp Exp $
4 # RCS: @(#) $Id: msgbox.tcl,v 1.7 2008/12/11 18:13:08 jenglish Exp $
55
66 if {![info exists widgetDemo]} {
77 error "This script should be run from the \"widget\" demo."
88 }
99
1010 package require Tk
11 package require Ttk
1211
1312 set w .msgbox
1413 catch {destroy $w}
22 # This demonstration script creates a text widget that describes
33 # the basic editing functions.
44 #
5 # RCS: @(#) $Id: text.tcl,v 1.8 2007/12/13 15:27:07 dgp Exp $
5 # RCS: @(#) $Id: text.tcl,v 1.9 2008/12/10 05:02:51 das Exp $
66
77 if {![info exists widgetDemo]} {
88 error "This script should be run from the \"widget\" demo."
1818 positionWindow $w
1919
2020 ## See Code / Dismiss buttons
21 set btns [addSeeDismiss $w.buttons $w]
21 set btns [addSeeDismiss $w.buttons $w {} \
22 {ttk::button $w.buttons.fontchooser -command fontchooserToggle}]
2223 pack $btns -side bottom -fill x
2324
2425 text $w.text -yscrollcommand [list $w.scroll set] -setgrid 1 \
2627 scrollbar $w.scroll -command [list $w.text yview]
2728 pack $w.scroll -side right -fill y
2829 pack $w.text -expand yes -fill both
30
31 # TIP 324 Demo: [tk fontchooser]
32 proc fontchooserToggle {} {
33 tk fontchooser [expr {[tk fontchooser configure -visible] ?
34 "hide" : "show"}]
35 }
36 proc fontchooserVisibility {w} {
37 $w configure -text [expr {[tk fontchooser configure -visible] ?
38 "Hide Font Dialog" : "Show Font Dialog"}]
39 }
40 proc fontchooserFocus {w} {
41 tk fontchooser configure -font [$w cget -font] \
42 -command [list fontchooserFontSel $w]
43 }
44 proc fontchooserFontSel {w font args} {
45 $w configure -font [font actual $font]
46 }
47 tk fontchooser configure -parent $w
48 bind $w.text <FocusIn> [list fontchooserFocus $w.text]
49 fontchooserVisibility $w.buttons.fontchooser
50 bind $w <<TkFontchooserVisibility>> [list \
51 fontchooserVisibility $w.buttons.fontchooser]
52 focus $w.text
53
2954 $w.text insert 0.0 \
3055 {This window is a text widget. It displays one or more lines of text
3156 and allows you to edit the text. Here is a summary of the things you
11 #
22 # This demonstration script creates a toolbar that can be torn off.
33 #
4 # RCS: @(#) $Id: toolbar.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
4 # RCS: @(#) $Id: toolbar.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
55
66 if {![info exists widgetDemo]} {
77 error "This script should be run from the \"widget\" demo."
88 }
99
1010 package require Tk
11 package require Ttk
1211
1312 set w .toolbar
1413 destroy $w
22 # This demonstration script creates a toplevel window containing a Ttk
33 # tree widget.
44 #
5 # RCS: @(#) $Id: tree.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp $
5 # RCS: @(#) $Id: tree.tcl,v 1.5 2008/12/11 18:13:08 jenglish Exp $
66
77 if {![info exists widgetDemo]} {
88 error "This script should be run from the \"widget\" demo."
99 }
1010
1111 package require Tk
12 package require Ttk
1312
1413 set w .tree
1514 catch {destroy $w}
7372 ## Create the tree and set it up
7473 ttk::treeview $w.tree -columns {fullpath type size} -displaycolumns {size} \
7574 -yscroll "$w.vsb set" -xscroll "$w.hsb set"
76 if {[tk windowingsystem] ne "aqua"} {
77 ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
78 ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
79 } else {
80 scrollbar $w.vsb -orient vertical -command "$w.tree yview"
81 scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
82 }
75 ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
76 ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
8377 $w.tree heading \#0 -text "Directory Structure"
8478 $w.tree heading size -text "File Size"
8579 $w.tree column size -stretch 0 -width 70
33 # simple Ttk widgets, such as labels, labelframes, buttons, checkbuttons and
44 # radiobuttons.
55 #
6 # RCS: @(#) $Id: ttkbut.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp $
6 # RCS: @(#) $Id: ttkbut.tcl,v 1.5 2008/12/11 18:13:08 jenglish Exp $
77
88 if {![info exists widgetDemo]} {
99 error "This script should be run from the \"widget\" demo."
1010 }
1111
1212 package require Tk
13 package require Ttk
1413
1514 set w .ttkbut
1615 catch {destroy $w}
22 # This demonstration script creates a toplevel window containing several Ttk
33 # menubutton widgets.
44 #
5 # RCS: @(#) $Id: ttkmenu.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
5 # RCS: @(#) $Id: ttkmenu.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
66
77 if {![info exists widgetDemo]} {
88 error "This script should be run from the \"widget\" demo."
99 }
1010
1111 package require Tk
12 package require Ttk
1312
1413 set w .ttkmenu
1514 catch {destroy $w}
22 # This demonstration script creates a toplevel window containing a Ttk
33 # notebook widget.
44 #
5 # RCS: @(#) $Id: ttknote.tcl,v 1.5 2007/12/13 15:27:07 dgp Exp $
5 # RCS: @(#) $Id: ttknote.tcl,v 1.6 2008/12/11 18:13:08 jenglish Exp $
66
77 if {![info exists widgetDemo]} {
88 error "This script should be run from the \"widget\" demo."
99 }
1010
1111 package require Tk
12 package require Ttk
1312
1413 set w .ttknote
1514 catch {destroy $w}
5453 $w.note add $w.note.editor -text "Text Editor" -underline 0
5554 text $w.note.editor.t -width 40 -height 10 -wrap char \
5655 -yscroll "$w.note.editor.s set"
57 if {[tk windowingsystem] ne "aqua"} {
58 ttk::scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
59 } else {
60 scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
61 }
56 ttk::scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
6257 pack $w.note.editor.s -side right -fill y -padx {0 2} -pady 2
6358 pack $w.note.editor.t -fill both -expand 1 -pady 2 -padx {2 0}
11 #
22 # This demonstration script creates a Ttk pane with some content.
33 #
4 # RCS: @(#) $Id: ttkpane.tcl,v 1.4 2008/06/24 13:37:32 patthoyts Exp $
4 # RCS: @(#) $Id: ttkpane.tcl,v 1.5 2008/12/11 18:13:08 jenglish Exp $
55
66 if {![info exists widgetDemo]} {
77 error "This script should be run from the \"widget\" demo."
88 }
99
1010 package require Tk
11 package require Ttk
1211
1312 set w .ttkpane
1413 catch {destroy $w}
11 #
22 # This demonstration script creates several progress bar widgets.
33 #
4 # RCS: @(#) $Id: ttkprogress.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
4 # RCS: @(#) $Id: ttkprogress.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
55
66 if {![info exists widgetDemo]} {
77 error "This script should be run from the \"widget\" demo."
88 }
99
1010 package require Tk
11 package require Ttk
1211
1312 set w .ttkprogress
1413 catch {destroy $w}
99 # separate ".tcl" files is this directory, which are sourced by this script as
1010 # needed.
1111 #
12 # RCS: @(#) $Id: widget,v 1.51 2008/03/11 22:30:17 das Exp $
12 # RCS: @(#) $Id: widget,v 1.54 2008/12/20 01:33:59 das Exp $
1313
1414 package require Tcl 8.5
1515 package require Tk 8.5
1616 package require msgcat
17 package require Ttk
1817
1918 eval destroy [winfo child .]
2019 set tk_demoDirectory [file join [pwd] [file dirname [info script]]]
386385 @@demo msgbox Message boxes
387386 @@demo filebox File selection dialog
388387 @@demo clrpick Color picker
388 @@new
389 @@demo fontchoose Font selection dialog
389390
390391 @@subtitle Animation
391392 @@new
0 # fontchooser.tcl -
1 #
2 # A themeable Tk font selection dialog. See TIP #324.
3 #
4 # Copyright (C) 2008 Keith Vetter
5 # Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
6 #
7 # See the file "license.terms" for information on usage and redistribution
8 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9 #
10 # RCS: @(#) $Id: fontchooser.tcl,v 1.2 2008/12/10 13:41:19 patthoyts Exp $
11
12 namespace eval ::tk::fontchooser {
13 variable S
14
15 set S(W) .__tk__fontchooser
16 set S(fonts) [lsort -dictionary [font families]]
17 set S(styles) [list \
18 [::msgcat::mc "Regular"] \
19 [::msgcat::mc "Italic"] \
20 [::msgcat::mc "Bold"] \
21 [::msgcat::mc "Bold Italic"] \
22 ]
23
24 set S(sizes) {8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72}
25 set S(strike) 0
26 set S(under) 0
27 set S(first) 1
28 set S(sampletext) [::msgcat::mc "AaBbYyZz01"]
29 set S(-parent) .
30 set S(-title) [::msgcat::mc "Font"]
31 set S(-command) ""
32 set S(-font) TkDefaultFont
33
34 # Canonical versions of font families, styles, etc. for easier searching
35 set S(fonts,lcase) {}
36 foreach font $S(fonts) { lappend S(fonts,lcase) [string tolower $font]}
37 set S(styles,lcase) {}
38 foreach style $S(styles) { lappend S(styles,lcase) [string tolower $style]}
39 set S(sizes,lcase) $S(sizes)
40
41 ::ttk::style layout FontchooserFrame {
42 Entry.field -sticky news -border true -children {
43 FontchooserFrame.padding -sticky news
44 }
45 }
46 bind [winfo class .] <<ThemeChanged>> \
47 [list +ttk::style layout FontchooserFrame \
48 [ttk::style layout FontchooserFrame]]
49
50 namespace ensemble create -map {
51 show ::tk::fontchooser::Show
52 hide ::tk::fontchooser::Hide
53 configure ::tk::fontchooser::Configure
54 }
55 }
56
57 proc ::tk::fontchooser::Show {} {
58 variable S
59 if {![winfo exists $S(W)]} {
60 Create
61 wm transient $S(W) [winfo toplevel $S(-parent)]
62 tk::PlaceWindow $S(W) widget $S(-parent)
63 }
64 wm deiconify $S(W)
65 }
66
67 proc ::tk::fontchooser::Hide {} {
68 variable S
69 wm withdraw $S(W)
70 }
71
72 proc ::tk::fontchooser::Configure {args} {
73 variable S
74
75 set specs {
76 {-parent "" "" . }
77 {-title "" "" ""}
78 {-font "" "" ""}
79 {-command "" "" ""}
80 }
81
82 if {[llength $args] == 0} {
83 set result {}
84 foreach spec $specs {
85 foreach {name xx yy default} $spec break
86 lappend result $name \
87 [expr {[info exists S($name)] ? $S($name) : $default}]
88 }
89 lappend result -visible \
90 [expr {[winfo exists $S(W)] && [winfo ismapped $S(W)]}]
91 return $result
92 }
93 if {[llength $args] == 1} {
94 set option [lindex $args 0]
95 if {[string equal $option "-visible"]} {
96 return [expr {[winfo exists $S(W)] && [winfo ismapped $S(W)]}]
97 } elseif {[info exists S($option)]} {
98 return $S($option)
99 }
100 return -code error "bad option \"$option\": must be\
101 -command, -font, -parent, -title or -visible"
102 }
103
104 set cache [dict create -parent $S(-parent) -title $S(-title) \
105 -font $S(-font) -command $S(-command)]
106 set r [tclParseConfigSpec [namespace which -variable S] $specs "" $args]
107 if {![winfo exists $S(-parent)]} {
108 set err "bad window path name \"$S(-parent)\""
109 array set S $cache
110 return -code error $err
111 }
112 if {[string trim $S(-title)] eq ""} {
113 set S(-title) [::msgcat::mc "Font"]
114 }
115 if {[winfo exists $S(W)] && [lsearch $args -font] != -1} {
116 Init $S(-font)
117 event generate $S(-parent) <<TkFontchooserFontChanged>>
118 }
119 return $r
120 }
121
122 proc ::tk::fontchooser::Create {} {
123 variable S
124 set windowName __tk__fontchooser
125 if {$S(-parent) eq "."} {
126 set S(W) .$windowName
127 } else {
128 set S(W) $S(-parent).$windowName
129 }
130
131 # Now build the dialog
132 if {![winfo exists $S(W)]} {
133 toplevel $S(W) -class TkFontDialog
134 if {[package provide tcltest] ne {}} {set ::tk_dialog $S(W)}
135 wm withdraw $S(W)
136 wm title $S(W) $S(-title)
137 wm transient $S(W) [winfo toplevel $S(-parent)]
138 wm geometry $S(W) 430x316
139
140 set outer [::ttk::frame $S(W).outer -padding {10 10}]
141 ::tk::AmpWidget ::ttk::label $S(W).font -text [::msgcat::mc "&Font:"]
142 ::tk::AmpWidget ::ttk::label $S(W).style -text [::msgcat::mc "Font st&yle:"]
143 ::tk::AmpWidget ::ttk::label $S(W).size -text [::msgcat::mc "&Size:"]
144 ttk::entry $S(W).efont -textvariable [namespace which -variable S](font)
145 ttk::entry $S(W).estyle -textvariable [namespace which -variable S](style)
146 ttk::entry $S(W).esize -textvariable [namespace which -variable S](size) \
147 -width 0 -validate key -validatecommand {string is double %P}
148
149 ttk_slistbox $S(W).lfonts -height 7 -exportselection 0 \
150 -selectmode browse -activestyle none \
151 -listvariable [namespace which -variable S](fonts)
152 ttk_slistbox $S(W).lstyles -width 5 -height 7 -exportselection 0 \
153 -selectmode browse -activestyle none \
154 -listvariable [namespace which -variable S](styles)
155 ttk_slistbox $S(W).lsizes -width 6 -height 7 -exportselection 0 \
156 -selectmode browse -activestyle none \
157 -listvariable [namespace which -variable S](sizes) \
158
159 set WE $S(W).effects
160 ::ttk::labelframe $WE -text [::msgcat::mc "Effects"]
161 ::tk::AmpWidget ::ttk::checkbutton $WE.strike \
162 -variable [namespace which -variable S](strike) \
163 -text [::msgcat::mc "Stri&keout"] \
164 -command [namespace code [list Click strike]]
165 ::tk::AmpWidget ::ttk::checkbutton $WE.under \
166 -variable [namespace which -variable S](under) \
167 -text [::msgcat::mc "&Underline"] \
168 -command [namespace code [list Click under]]
169
170 set bbox [::ttk::frame $S(W).bbox]
171 ::ttk::button $S(W).ok -text [::msgcat::mc OK] -default active\
172 -command [namespace code [list Done 1]]
173 ::ttk::button $S(W).cancel -text [::msgcat::mc Cancel] \
174 -command [namespace code [list Done 0]]
175 ::tk::AmpWidget ::ttk::button $S(W).apply -text [::msgcat::mc "&Apply"] \
176 -command [namespace code [list Apply]]
177 wm protocol $S(W) WM_DELETE_WINDOW [namespace code [list Done 0]]
178
179 bind $S(W) <Return> [namespace code [list Done 1]]
180 bind $S(W) <Escape> [namespace code [list Done 0]]
181 bind $S(W) <Map> [namespace code [list Visibility %W 1]]
182 bind $S(W) <Unmap> [namespace code [list Visibility %W 0]]
183 bind $S(W) <Destroy> [namespace code [list Visibility %W 0]]
184 bind $S(W).lfonts.list <<ListboxSelect>> [namespace code [list Click font]]
185 bind $S(W).lstyles.list <<ListboxSelect>> [namespace code [list Click style]]
186 bind $S(W).lsizes.list <<ListboxSelect>> [namespace code [list Click size]]
187 bind $S(W) <Alt-Key> [list ::tk::AltKeyInDialog $S(W) %A]
188 bind $S(W).font <<AltUnderlined>> [list ::focus $S(W).efont]
189 bind $S(W).style <<AltUnderlined>> [list ::focus $S(W).estyle]
190 bind $S(W).size <<AltUnderlined>> [list ::focus $S(W).esize]
191 bind $S(W).apply <<AltUnderlined>> [namespace code [list Apply]]
192 bind $WE.strike <<AltUnderlined>> [list $WE.strike invoke]
193 bind $WE.under <<AltUnderlined>> [list $WE.under invoke]
194
195 set WS $S(W).sample
196 ::ttk::labelframe $WS -text [::msgcat::mc "Sample"]
197 ::ttk::label $WS.sample -relief sunken -anchor center \
198 -textvariable [namespace which -variable S](sampletext)
199 set S(sample) $WS.sample
200 grid $WS.sample -sticky news -padx 8 -pady 6
201 grid rowconfigure $WS 0 -weight 1
202 grid columnconfigure $WS 0 -weight 1
203 grid propagate $WS 0
204
205 grid $S(W).ok -in $bbox -sticky new -pady {0 2}
206 grid $S(W).cancel -in $bbox -sticky new -pady 2
207 if {$S(-command) ne ""} {
208 grid $S(W).apply -in $bbox -sticky new -pady 2
209 }
210 grid columnconfigure $bbox 0 -weight 1
211
212 grid $WE.strike -sticky w -padx 10
213 grid $WE.under -sticky w -padx 10 -pady {0 30}
214 grid columnconfigure $WE 1 -weight 1
215
216 grid $S(W).font x $S(W).style x $S(W).size x -in $outer -sticky w
217 grid $S(W).efont x $S(W).estyle x $S(W).esize x $bbox -in $outer -sticky ew
218 grid $S(W).lfonts x $S(W).lstyles x $S(W).lsizes x ^ -in $outer -sticky news
219 grid $WE x $WS - - x ^ -in $outer -sticky news -pady {15 30}
220 grid configure $bbox -sticky n
221 grid columnconfigure $outer {1 3 5} -minsize 10
222 grid columnconfigure $outer {0 2 4} -weight 1
223
224 grid $outer -sticky news
225 grid rowconfigure $S(W) 0 -weight 1
226 grid columnconfigure $S(W) 0 -weight 1
227
228 Init $S(-font)
229
230 trace add variable [namespace which -variable S](size) \
231 write [namespace code [list Tracer]]
232 trace add variable [namespace which -variable S](style) \
233 write [namespace code [list Tracer]]
234 trace add variable [namespace which -variable S](font) \
235 write [namespace code [list Tracer]]
236 } else {
237 Init $S(-font)
238 }
239
240 return
241 }
242
243 # ::tk::fontchooser::Done --
244 #
245 # Handles teardown of the dialog, calling -command if needed
246 #
247 # Arguments:
248 # ok true if user pressed OK
249 #
250 proc ::tk::::fontchooser::Done {ok} {
251 variable S
252
253 if {! $ok} {
254 set S(result) ""
255 }
256 trace vdelete S(size) w [namespace code [list Tracer]]
257 trace vdelete S(style) w [namespace code [list Tracer]]
258 trace vdelete S(font) w [namespace code [list Tracer]]
259 destroy $S(W)
260 if {$ok && $S(-command) ne ""} {
261 uplevel #0 $S(-command) [list $S(result)]
262 }
263 }
264
265 # ::tk::fontchooser::Apply --
266 #
267 # Call the -command procedure appending the current font
268 # Errors are reported via the background error mechanism
269 #
270 proc ::tk::fontchooser::Apply {} {
271 variable S
272 if {$S(-command) ne ""} {
273 if {[catch {uplevel #0 $S(-command) [list $S(result)]} err]} {
274 ::bgerror $err
275 }
276 }
277 event generate $S(-parent) <<TkFontchooserFontChanged>>
278 }
279
280 # ::tk::fontchooser::Init --
281 #
282 # Initializes dialog to a default font
283 #
284 # Arguments:
285 # defaultFont font to use as the default
286 #
287 proc ::tk::fontchooser::Init {{defaultFont ""}} {
288 variable S
289
290 if {$S(first) || $defaultFont ne ""} {
291 if {$defaultFont eq ""} {
292 set defaultFont [[entry .___e] cget -font]
293 destroy .___e
294 }
295 array set F [font actual $defaultFont]
296 set S(font) $F(-family)
297 set S(size) $F(-size)
298 set S(strike) $F(-overstrike)
299 set S(under) $F(-underline)
300 set S(style) "Regular"
301 if {$F(-weight) eq "bold" && $F(-slant) eq "italic"} {
302 set S(style) "Bold Italic"
303 } elseif {$F(-weight) eq "bold"} {
304 set S(style) "Bold"
305 } elseif {$F(-slant) eq "italic"} {
306 set S(style) "Italic"
307 }
308
309 set S(first) 0
310 }
311
312 Tracer a b c
313 Update
314 }
315
316 # ::tk::fontchooser::Click --
317 #
318 # Handles all button clicks, updating the appropriate widgets
319 #
320 # Arguments:
321 # who which widget got pressed
322 #
323 proc ::tk::fontchooser::Click {who} {
324 variable S
325
326 if {$who eq "font"} {
327 set S(font) [$S(W).lfonts get [$S(W).lfonts curselection]]
328 } elseif {$who eq "style"} {
329 set S(style) [$S(W).lstyles get [$S(W).lstyles curselection]]
330 } elseif {$who eq "size"} {
331 set S(size) [$S(W).lsizes get [$S(W).lsizes curselection]]
332 }
333 Update
334 }
335
336 # ::tk::fontchooser::Tracer --
337 #
338 # Handles traces on key variables, updating the appropriate widgets
339 #
340 # Arguments:
341 # standard trace arguments (not used)
342 #
343 proc ::tk::fontchooser::Tracer {var1 var2 op} {
344 variable S
345
346 set bad 0
347 set nstate normal
348 # Make selection in each listbox
349 foreach var {font style size} {
350 set value [string tolower $S($var)]
351 $S(W).l${var}s selection clear 0 end
352 set n [lsearch -exact $S(${var}s,lcase) $value]
353 $S(W).l${var}s selection set $n
354 if {$n != -1} {
355 set S($var) [lindex $S(${var}s) $n]
356 $S(W).e$var icursor end
357 $S(W).e$var selection clear
358 } else { ;# No match, try prefix
359 # Size is weird: valid numbers are legal but don't display
360 # unless in the font size list
361 set n [lsearch -glob $S(${var}s,lcase) "$value*"]
362 set bad 1
363 if {$var ne "size" || ! [string is double -strict $value]} {
364 set nstate disabled
365 }
366 }
367 $S(W).l${var}s see $n
368 }
369 if {!$bad} { Update }
370 $S(W).ok configure -state $nstate
371 }
372
373 # ::tk::fontchooser::Update --
374 #
375 # Shows a sample of the currently selected font
376 #
377 proc ::tk::fontchooser::Update {} {
378 variable S
379
380 set S(result) [list $S(font) $S(size)]
381 if {$S(style) eq "Bold"} { lappend S(result) bold }
382 if {$S(style) eq "Italic"} { lappend S(result) italic }
383 if {$S(style) eq "Bold Italic"} { lappend S(result) bold italic}
384 if {$S(strike)} { lappend S(result) overstrike}
385 if {$S(under)} { lappend S(result) underline}
386
387 $S(sample) configure -font $S(result)
388 }
389
390 # ::tk::fontchooser::Visibility --
391 #
392 # Notify the parent when the dialog visibility changes
393 #
394 proc ::tk::fontchooser::Visibility {w visible} {
395 variable S
396 if {$w eq $S(W)} {
397 event generate $S(-parent) <<TkFontchooserVisibility>>
398 }
399 }
400
401 # ::tk::fontchooser::ttk_listbox --
402 #
403 # Create a properly themed scrolled listbox.
404 # This is exactly right on XP but may need adjusting on other platforms.
405 #
406 proc ::tk::fontchooser::ttk_slistbox {w args} {
407 set f [ttk::frame $w -style FontchooserFrame -padding 2]
408 if {[catch {
409 listbox $f.list -relief flat -highlightthickness 0 -borderwidth 0 {*}$args
410 ttk::scrollbar $f.vs -command [list $f.list yview]
411 $f.list configure -yscrollcommand [list $f.vs set]
412 grid $f.list $f.vs -sticky news
413 grid rowconfigure $f 0 -weight 1
414 grid columnconfigure $f 0 -weight 1
415 interp hide {} $w
416 interp alias {} $w {} $f.list
417 } err]} {
418 destroy $f
419 return -code error $err
420 }
421 return $w
422 }
00 # mkpsenc.tcl --
11 #
2 # Creates Postscript encoding vector for given encoding
3 #
4
5 proc ::tk::CreatePostscriptEncoding {encoding} {
6 # now check for known. Even if it is known, it can be other
7 # than we need. GhostScript seems to be happy with such approach
8 set result "/CurrentEncoding \[\n"
9 for {set i 0} {$i<256} {incr i 8} {
10 for {set j 0} {$j<8} {incr j} {
11 set enc [encoding convertfrom $encoding [format %c [expr {$i+$j}]]]
12 if {[catch {format %04X [scan $enc %c]} hexcode]} {set hexcode {}}
13 if [info exists ::tk::psglyphs($hexcode)] {
14 append result "/$::tk::psglyphs($hexcode)"
15 } else {
16 append result "/space"
2 # This file generates the postscript prolog used by Tk.
3
4 namespace eval ::tk {
5 # Creates Postscript encoding vector for given encoding
6 #
7 proc CreatePostscriptEncoding {encoding} {
8 variable psglyphs
9 # Now check for known. Even if it is known, it can be other than we
10 # need. GhostScript seems to be happy with such approach
11 set result "/CurrentEncoding \[\n"
12 for {set i 0} {$i<256} {incr i 8} {
13 for {set j 0} {$j<8} {incr j} {
14 set enc [encoding convertfrom $encoding \
15 [format %c [expr {$i+$j}]]]
16 catch {
17 set hexcode {}
18 set hexcode [format %04X [scan $enc %c]]
19 }
20 if {[info exists psglyphs($hexcode)]} {
21 append result "/$psglyphs($hexcode)"
22 } else {
23 append result "/space"
24 }
1725 }
26 append result "\n"
1827 }
19 append result "\n"
28 append result "\] def\n"
29 return $result
2030 }
21 append result "\] def\n"
22 return $result
23 }
24
25 # List of adobe glyph names. Converted from glyphlist.txt, downloaded
26 # from Adobe
27
28 namespace eval ::tk {
29 array set psglyphs {
30 0020 space
31 0021 exclam
32 0022 quotedbl
33 0023 numbersign
34 0024 dollar
35 0025 percent
36 0026 ampersand
37 0027 quotesingle
38 0028 parenleft
39 0029 parenright
40 002A asterisk
41 002B plus
42 002C comma
43 002D hyphen
44 002E period
45 002F slash
46 0030 zero
47 0031 one
48 0032 two
49 0033 three
50 0034 four
51 0035 five
52 0036 six
53 0037 seven
54 0038 eight
55 0039 nine
56 003A colon
57 003B semicolon
58 003C less
59 003D equal
60 003E greater
61 003F question
62 0040 at
63 0041 A
64 0042 B
65 0043 C
66 0044 D
67 0045 E
68 0046 F
69 0047 G
70 0048 H
71 0049 I
72 004A J
73 004B K
74 004C L
75 004D M
76 004E N
77 004F O
78 0050 P
79 0051 Q
80 0052 R
81 0053 S
82 0054 T
83 0055 U
84 0056 V
85 0057 W
86 0058 X
87 0059 Y
88 005A Z
89 005B bracketleft
90 005C backslash
91 005D bracketright
92 005E asciicircum
93 005F underscore
94 0060 grave
95 0061 a
96 0062 b
97 0063 c
98 0064 d
99 0065 e
100 0066 f
101 0067 g
102 0068 h
103 0069 i
104 006A j
105 006B k
106 006C l
107 006D m
108 006E n
109 006F o
110 0070 p
111 0071 q
112 0072 r
113 0073 s
114 0074 t
115 0075 u
116 0076 v
117 0077 w
118 0078 x
119 0079 y
120 007A z
121 007B braceleft
122 007C bar
123 007D braceright
124 007E asciitilde
125 00A0 space
126 00A1 exclamdown
127 00A2 cent
128 00A3 sterling
129 00A4 currency
130 00A5 yen
131 00A6 brokenbar
132 00A7 section
133 00A8 dieresis
134 00A9 copyright
135 00AA ordfeminine
136 00AB guillemotleft
137 00AC logicalnot
138 00AD hyphen
139 00AE registered
140 00AF macron
141 00B0 degree
142 00B1 plusminus
143 00B2 twosuperior
144 00B3 threesuperior
145 00B4 acute
146 00B5 mu
147 00B6 paragraph
148 00B7 periodcentered
149 00B8 cedilla
150 00B9 onesuperior
151 00BA ordmasculine
152 00BB guillemotright
153 00BC onequarter
154 00BD onehalf
155 00BE threequarters
156 00BF questiondown
157 00C0 Agrave
158 00C1 Aacute
159 00C2 Acircumflex
160 00C3 Atilde
161 00C4 Adieresis
162 00C5 Aring
163 00C6 AE
164 00C7 Ccedilla
165 00C8 Egrave
166 00C9 Eacute
167 00CA Ecircumflex
168 00CB Edieresis
169 00CC Igrave
170 00CD Iacute
171 00CE Icircumflex
172 00CF Idieresis
173 00D0 Eth
174 00D1 Ntilde
175 00D2 Ograve
176 00D3 Oacute
177 00D4 Ocircumflex
178 00D5 Otilde
179 00D6 Odieresis
180 00D7 multiply
181 00D8 Oslash
182 00D9 Ugrave
183 00DA Uacute
184 00DB Ucircumflex
185 00DC Udieresis
186 00DD Yacute
187 00DE Thorn
188 00DF germandbls
189 00E0 agrave
190 00E1 aacute
191 00E2 acircumflex
192 00E3 atilde
193 00E4 adieresis
194 00E5 aring
195 00E6 ae
196 00E7 ccedilla
197 00E8 egrave
198 00E9 eacute
199 00EA ecircumflex
200 00EB edieresis
201 00EC igrave
202 00ED iacute
203 00EE icircumflex
204 00EF idieresis
205 00F0 eth
206 00F1 ntilde
207 00F2 ograve
208 00F3 oacute
209 00F4 ocircumflex
210 00F5 otilde
211 00F6 odieresis
212 00F7 divide
213 00F8 oslash
214 00F9 ugrave
215 00FA uacute
216 00FB ucircumflex
217 00FC udieresis
218 00FD yacute
219 00FE thorn
220 00FF ydieresis
221 0100 Amacron
222 0101 amacron
223 0102 Abreve
224 0103 abreve
225 0104 Aogonek
226 0105 aogonek
227 0106 Cacute
228 0107 cacute
229 0108 Ccircumflex
230 0109 ccircumflex
231 010A Cdotaccent
232 010B cdotaccent
233 010C Ccaron
234 010D ccaron
235 010E Dcaron
236 010F dcaron
237 0110 Dcroat
238 0111 dcroat
239 0112 Emacron
240 0113 emacron
241 0114 Ebreve
242 0115 ebreve
243 0116 Edotaccent
244 0117 edotaccent
245 0118 Eogonek
246 0119 eogonek
247 011A Ecaron
248 011B ecaron
249 011C Gcircumflex
250 011D gcircumflex
251 011E Gbreve
252 011F gbreve
253 0120 Gdotaccent
254 0121 gdotaccent
255 0122 Gcommaaccent
256 0123 gcommaaccent
257 0124 Hcircumflex
258 0125 hcircumflex
259 0126 Hbar
260 0127 hbar
261 0128 Itilde
262 0129 itilde
263 012A Imacron
264 012B imacron
265 012C Ibreve
266 012D ibreve
267 012E Iogonek
268 012F iogonek
269 0130 Idotaccent
270 0131 dotlessi
271 0132 IJ
272 0133 ij
273 0134 Jcircumflex
274 0135 jcircumflex
275 0136 Kcommaaccent
276 0137 kcommaaccent
277 0138 kgreenlandic
278 0139 Lacute
279 013A lacute
280 013B Lcommaaccent
281 013C lcommaaccent
282 013D Lcaron
283 013E lcaron
284 013F Ldot
285 0140 ldot
286 0141 Lslash
287 0142 lslash
288 0143 Nacute
289 0144 nacute
290 0145 Ncommaaccent
291 0146 ncommaaccent
292 0147 Ncaron
293 0148 ncaron
294 0149 napostrophe
295 014A Eng
296 014B eng
297 014C Omacron
298 014D omacron
299 014E Obreve
300 014F obreve
301 0150 Ohungarumlaut
302 0151 ohungarumlaut
303 0152 OE
304 0153 oe
305 0154 Racute
306 0155 racute
307 0156 Rcommaaccent
308 0157 rcommaaccent
309 0158 Rcaron
310 0159 rcaron
311 015A Sacute
312 015B sacute
313 015C Scircumflex
314 015D scircumflex
315 015E Scedilla
316 015F scedilla
317 0160 Scaron
318 0161 scaron
319 0162 Tcommaaccent
320 0163 tcommaaccent
321 0164 Tcaron
322 0165 tcaron
323 0166 Tbar
324 0167 tbar
325 0168 Utilde
326 0169 utilde
327 016A Umacron
328 016B umacron
329 016C Ubreve
330 016D ubreve
331 016E Uring
332 016F uring
333 0170 Uhungarumlaut
334 0171 uhungarumlaut
335 0172 Uogonek
336 0173 uogonek
337 0174 Wcircumflex
338 0175 wcircumflex
339 0176 Ycircumflex
340 0177 ycircumflex
341 0178 Ydieresis
342 0179 Zacute
343 017A zacute
344 017B Zdotaccent
345 017C zdotaccent
346 017D Zcaron
347 017E zcaron
348 017F longs
349 0192 florin
350 01A0 Ohorn
351 01A1 ohorn
352 01AF Uhorn
353 01B0 uhorn
354 01E6 Gcaron
355 01E7 gcaron
356 01FA Aringacute
357 01FB aringacute
358 01FC AEacute
359 01FD aeacute
360 01FE Oslashacute
361 01FF oslashacute
362 0218 Scommaaccent
363 0219 scommaaccent
364 021A Tcommaaccent
365 021B tcommaaccent
366 02BC afii57929
367 02BD afii64937
368 02C6 circumflex
369 02C7 caron
370 02C9 macron
371 02D8 breve
372 02D9 dotaccent
373 02DA ring
374 02DB ogonek
375 02DC tilde
376 02DD hungarumlaut
377 0300 gravecomb
378 0301 acutecomb
379 0303 tildecomb
380 0309 hookabovecomb
381 0323 dotbelowcomb
382 0384 tonos
383 0385 dieresistonos
384 0386 Alphatonos
385 0387 anoteleia
386 0388 Epsilontonos
387 0389 Etatonos
388 038A Iotatonos
389 038C Omicrontonos
390 038E Upsilontonos
391 038F Omegatonos
392 0390 iotadieresistonos
393 0391 Alpha
394 0392 Beta
395 0393 Gamma
396 0394 Delta
397 0395 Epsilon
398 0396 Zeta
399 0397 Eta
400 0398 Theta
401 0399 Iota
402 039A Kappa
403 039B Lambda
404 039C Mu
405 039D Nu
406 039E Xi
407 039F Omicron
408 03A0 Pi
409 03A1 Rho
410 03A3 Sigma
411 03A4 Tau
412 03A5 Upsilon
413 03A6 Phi
414 03A7 Chi
415 03A8 Psi
416 03A9 Omega
417 03AA Iotadieresis
418 03AB Upsilondieresis
419 03AC alphatonos
420 03AD epsilontonos
421 03AE etatonos
422 03AF iotatonos
423 03B0 upsilondieresistonos
424 03B1 alpha
425 03B2 beta
426 03B3 gamma
427 03B4 delta
428 03B5 epsilon
429 03B6 zeta
430 03B7 eta
431 03B8 theta
432 03B9 iota
433 03BA kappa
434 03BB lambda
435 03BC mu
436 03BD nu
437 03BE xi
438 03BF omicron
439 03C0 pi
440 03C1 rho
441 03C2 sigma1
442 03C3 sigma
443 03C4 tau
444 03C5 upsilon
445 03C6 phi
446 03C7 chi
447 03C8 psi
448 03C9 omega
449 03CA iotadieresis
450 03CB upsilondieresis
451 03CC omicrontonos
452 03CD upsilontonos
453 03CE omegatonos
454 03D1 theta1
455 03D2 Upsilon1
456 03D5 phi1
457 03D6 omega1
458 0401 afii10023
459 0402 afii10051
460 0403 afii10052
461 0404 afii10053
462 0405 afii10054
463 0406 afii10055
464 0407 afii10056
465 0408 afii10057
466 0409 afii10058
467 040A afii10059
468 040B afii10060
469 040C afii10061
470 040E afii10062
471 040F afii10145
472 0410 afii10017
473 0411 afii10018
474 0412 afii10019
475 0413 afii10020
476 0414 afii10021
477 0415 afii10022
478 0416 afii10024
479 0417 afii10025
480 0418 afii10026
481 0419 afii10027
482 041A afii10028
483 041B afii10029
484 041C afii10030
485 041D afii10031
486 041E afii10032
487 041F afii10033
488 0420 afii10034
489 0421 afii10035
490 0422 afii10036
491 0423 afii10037
492 0424 afii10038
493 0425 afii10039
494 0426 afii10040
495 0427 afii10041
496 0428 afii10042
497 0429 afii10043
498 042A afii10044
499 042B afii10045
500 042C afii10046
501 042D afii10047
502 042E afii10048
503 042F afii10049
504 0430 afii10065
505 0431 afii10066
506 0432 afii10067
507 0433 afii10068
508 0434 afii10069
509 0435 afii10070
510 0436 afii10072
511 0437 afii10073
512 0438 afii10074
513 0439 afii10075
514 043A afii10076
515 043B afii10077
516 043C afii10078
517 043D afii10079
518 043E afii10080
519 043F afii10081
520 0440 afii10082
521 0441 afii10083
522 0442 afii10084
523 0443 afii10085
524 0444 afii10086
525 0445 afii10087
526 0446 afii10088
527 0447 afii10089
528 0448 afii10090
529 0449 afii10091
530 044A afii10092
531 044B afii10093
532 044C afii10094
533 044D afii10095
534 044E afii10096
535 044F afii10097
536 0451 afii10071
537 0452 afii10099
538 0453 afii10100
539 0454 afii10101
540 0455 afii10102
541 0456 afii10103
542 0457 afii10104
543 0458 afii10105
544 0459 afii10106
545 045A afii10107
546 045B afii10108
547 045C afii10109
548 045E afii10110
549 045F afii10193
550 0462 afii10146
551 0463 afii10194
552 0472 afii10147
553 0473 afii10195
554 0474 afii10148
555 0475 afii10196
556 0490 afii10050
557 0491 afii10098
558 04D9 afii10846
559 05B0 afii57799
560 05B1 afii57801
561 05B2 afii57800
562 05B3 afii57802
563 05B4 afii57793
564 05B5 afii57794
565 05B6 afii57795
566 05B7 afii57798
567 05B8 afii57797
568 05B9 afii57806
569 05BB afii57796
570 05BC afii57807
571 05BD afii57839
572 05BE afii57645
573 05BF afii57841
574 05C0 afii57842
575 05C1 afii57804
576 05C2 afii57803
577 05C3 afii57658
578 05D0 afii57664
579 05D1 afii57665
580 05D2 afii57666
581 05D3 afii57667
582 05D4 afii57668
583 05D5 afii57669
584 05D6 afii57670
585 05D7 afii57671
586 05D8 afii57672
587 05D9 afii57673
588 05DA afii57674
589 05DB afii57675
590 05DC afii57676
591 05DD afii57677
592 05DE afii57678
593 05DF afii57679
594 05E0 afii57680
595 05E1 afii57681
596 05E2 afii57682
597 05E3 afii57683
598 05E4 afii57684
599 05E5 afii57685
600 05E6 afii57686
601 05E7 afii57687
602 05E8 afii57688
603 05E9 afii57689
604 05EA afii57690
605 05F0 afii57716
606 05F1 afii57717
607 05F2 afii57718
608 060C afii57388
609 061B afii57403
610 061F afii57407
611 0621 afii57409
612 0622 afii57410
613 0623 afii57411
614 0624 afii57412
615 0625 afii57413
616 0626 afii57414
617 0627 afii57415
618 0628 afii57416
619 0629 afii57417
620 062A afii57418
621 062B afii57419
622 062C afii57420
623 062D afii57421
624 062E afii57422
625 062F afii57423
626 0630 afii57424
627 0631 afii57425
628 0632 afii57426
629 0633 afii57427
630 0634 afii57428
631 0635 afii57429
632 0636 afii57430
633 0637 afii57431
634 0638 afii57432
635 0639 afii57433
636 063A afii57434
637 0640 afii57440
638 0641 afii57441
639 0642 afii57442
640 0643 afii57443
641 0644 afii57444
642 0645 afii57445
643 0646 afii57446
644 0647 afii57470
645 0648 afii57448
646 0649 afii57449
647 064A afii57450
648 064B afii57451
649 064C afii57452
650 064D afii57453
651 064E afii57454
652 064F afii57455
653 0650 afii57456
654 0651 afii57457
655 0652 afii57458
656 0660 afii57392
657 0661 afii57393
658 0662 afii57394
659 0663 afii57395
660 0664 afii57396
661 0665 afii57397
662 0666 afii57398
663 0667 afii57399
664 0668 afii57400
665 0669 afii57401
666 066A afii57381
667 066D afii63167
668 0679 afii57511
669 067E afii57506
670 0686 afii57507
671 0688 afii57512
672 0691 afii57513
673 0698 afii57508
674 06A4 afii57505
675 06AF afii57509
676 06BA afii57514
677 06D2 afii57519
678 06D5 afii57534
679 1E80 Wgrave
680 1E81 wgrave
681 1E82 Wacute
682 1E83 wacute
683 1E84 Wdieresis
684 1E85 wdieresis
685 1EF2 Ygrave
686 1EF3 ygrave
687 200C afii61664
688 200D afii301
689 200E afii299
690 200F afii300
691 2012 figuredash
692 2013 endash
693 2014 emdash
694 2015 afii00208
695 2017 underscoredbl
696 2018 quoteleft
697 2019 quoteright
698 201A quotesinglbase
699 201B quotereversed
700 201C quotedblleft
701 201D quotedblright
702 201E quotedblbase
703 2020 dagger
704 2021 daggerdbl
705 2022 bullet
706 2024 onedotenleader
707 2025 twodotenleader
708 2026 ellipsis
709 202C afii61573
710 202D afii61574
711 202E afii61575
712 2030 perthousand
713 2032 minute
714 2033 second
715 2039 guilsinglleft
716 203A guilsinglright
717 203C exclamdbl
718 2044 fraction
719 2070 zerosuperior
720 2074 foursuperior
721 2075 fivesuperior
722 2076 sixsuperior
723 2077 sevensuperior
724 2078 eightsuperior
725 2079 ninesuperior
726 207D parenleftsuperior
727 207E parenrightsuperior
728 207F nsuperior
729 2080 zeroinferior
730 2081 oneinferior
731 2082 twoinferior
732 2083 threeinferior
733 2084 fourinferior
734 2085 fiveinferior
735 2086 sixinferior
736 2087 seveninferior
737 2088 eightinferior
738 2089 nineinferior
739 208D parenleftinferior
740 208E parenrightinferior
741 20A1 colonmonetary
742 20A3 franc
743 20A4 lira
744 20A7 peseta
745 20AA afii57636
746 20AB dong
747 20AC Euro
748 2105 afii61248
749 2111 Ifraktur
750 2113 afii61289
751 2116 afii61352
752 2118 weierstrass
753 211C Rfraktur
754 211E prescription
755 2122 trademark
756 2126 Omega
757 212E estimated
758 2135 aleph
759 2153 onethird
760 2154 twothirds
761 215B oneeighth
762 215C threeeighths
763 215D fiveeighths
764 215E seveneighths
765 2190 arrowleft
766 2191 arrowup
767 2192 arrowright
768 2193 arrowdown
769 2194 arrowboth
770 2195 arrowupdn
771 21A8 arrowupdnbse
772 21B5 carriagereturn
773 21D0 arrowdblleft
774 21D1 arrowdblup
775 21D2 arrowdblright
776 21D3 arrowdbldown
777 21D4 arrowdblboth
778 2200 universal
779 2202 partialdiff
780 2203 existential
781 2205 emptyset
782 2206 Delta
783 2207 gradient
784 2208 element
785 2209 notelement
786 220B suchthat
787 220F product
788 2211 summation
789 2212 minus
790 2215 fraction
791 2217 asteriskmath
792 2219 periodcentered
793 221A radical
794 221D proportional
795 221E infinity
796 221F orthogonal
797 2220 angle
798 2227 logicaland
799 2228 logicalor
800 2229 intersection
801 222A union
802 222B integral
803 2234 therefore
804 223C similar
805 2245 congruent
806 2248 approxequal
807 2260 notequal
808 2261 equivalence
809 2264 lessequal
810 2265 greaterequal
811 2282 propersubset
812 2283 propersuperset
813 2284 notsubset
814 2286 reflexsubset
815 2287 reflexsuperset
816 2295 circleplus
817 2297 circlemultiply
818 22A5 perpendicular
819 22C5 dotmath
820 2302 house
821 2310 revlogicalnot
822 2320 integraltp
823 2321 integralbt
824 2329 angleleft
825 232A angleright
826 2500 SF100000
827 2502 SF110000
828 250C SF010000
829 2510 SF030000
830 2514 SF020000
831 2518 SF040000
832 251C SF080000
833 2524 SF090000
834 252C SF060000
835 2534 SF070000
836 253C SF050000
837 2550 SF430000
838 2551 SF240000
839 2552 SF510000
840 2553 SF520000
841 2554 SF390000
842 2555 SF220000
843 2556 SF210000
844 2557 SF250000
845 2558 SF500000
846 2559 SF490000
847 255A SF380000
848 255B SF280000
849 255C SF270000
850 255D SF260000
851 255E SF360000
852 255F SF370000
853 2560 SF420000
854 2561 SF190000
855 2562 SF200000
856 2563 SF230000
857 2564 SF470000
858 2565 SF480000
859 2566 SF410000
860 2567 SF450000
861 2568 SF460000
862 2569 SF400000
863 256A SF540000
864 256B SF530000
865 256C SF440000
866 2580 upblock
867 2584 dnblock
868 2588 block
869 258C lfblock
870 2590 rtblock
871 2591 ltshade
872 2592 shade
873 2593 dkshade
874 25A0 filledbox
875 25A1 H22073
876 25AA H18543
877 25AB H18551
878 25AC filledrect
879 25B2 triagup
880 25BA triagrt
881 25BC triagdn
882 25C4 triaglf
883 25CA lozenge
884 25CB circle
885 25CF H18533
886 25D8 invbullet
887 25D9 invcircle
888 25E6 openbullet
889 263A smileface
890 263B invsmileface
891 263C sun
892 2640 female
893 2642 male
894 2660 spade
895 2663 club
896 2665 heart
897 2666 diamond
898 266A musicalnote
899 266B musicalnotedbl
900 F6BE dotlessj
901 F6BF LL
902 F6C0 ll
903 F6C1 Scedilla
904 F6C2 scedilla
905 F6C3 commaaccent
906 F6C4 afii10063
907 F6C5 afii10064
908 F6C6 afii10192
909 F6C7 afii10831
910 F6C8 afii10832
911 F6C9 Acute
912 F6CA Caron
913 F6CB Dieresis
914 F6CC DieresisAcute
915 F6CD DieresisGrave
916 F6CE Grave
917 F6CF Hungarumlaut
918 F6D0 Macron
919 F6D1 cyrBreve
920 F6D2 cyrFlex
921 F6D3 dblGrave
922 F6D4 cyrbreve
923 F6D5 cyrflex
924 F6D6 dblgrave
925 F6D7 dieresisacute
926 F6D8 dieresisgrave
927 F6D9 copyrightserif
928 F6DA registerserif
929 F6DB trademarkserif
930 F6DC onefitted
931 F6DD rupiah
932 F6DE threequartersemdash
933 F6DF centinferior
934 F6E0 centsuperior
935 F6E1 commainferior
936 F6E2 commasuperior
937 F6E3 dollarinferior
938 F6E4 dollarsuperior
939 F6E5 hypheninferior
940 F6E6 hyphensuperior
941 F6E7 periodinferior
942 F6E8 periodsuperior
943 F6E9 asuperior
944 F6EA bsuperior
945 F6EB dsuperior
946 F6EC esuperior
947 F6ED isuperior
948 F6EE lsuperior
949 F6EF msuperior
950 F6F0 osuperior
951 F6F1 rsuperior
952 F6F2 ssuperior
953 F6F3 tsuperior
954 F6F4 Brevesmall
955 F6F5 Caronsmall
956 F6F6 Circumflexsmall
957 F6F7 Dotaccentsmall
958 F6F8 Hungarumlautsmall
959 F6F9 Lslashsmall
960 F6FA OEsmall
961 F6FB Ogoneksmall
962 F6FC Ringsmall
963 F6FD Scaronsmall
964 F6FE Tildesmall
965 F6FF Zcaronsmall
966 F721 exclamsmall
967 F724 dollaroldstyle
968 F726 ampersandsmall
969 F730 zerooldstyle
970 F731 oneoldstyle
971 F732 twooldstyle
972 F733 threeoldstyle
973 F734 fouroldstyle
974 F735 fiveoldstyle
975 F736 sixoldstyle
976 F737 sevenoldstyle
977 F738 eightoldstyle
978 F739 nineoldstyle
979 F73F questionsmall
980 F760 Gravesmall
981 F761 Asmall
982 F762 Bsmall
983 F763 Csmall
984 F764 Dsmall
985 F765 Esmall
986 F766 Fsmall
987 F767 Gsmall
988 F768 Hsmall
989 F769 Ismall
990 F76A Jsmall
991 F76B Ksmall
992 F76C Lsmall
993 F76D Msmall
994 F76E Nsmall
995 F76F Osmall
996 F770 Psmall
997 F771 Qsmall
998 F772 Rsmall
999 F773 Ssmall
1000 F774 Tsmall
1001 F775 Usmall
1002 F776 Vsmall
1003 F777 Wsmall
1004 F778 Xsmall
1005 F779 Ysmall
1006 F77A Zsmall
1007 F7A1 exclamdownsmall
1008 F7A2 centoldstyle
1009 F7A8 Dieresissmall
1010 F7AF Macronsmall
1011 F7B4 Acutesmall
1012 F7B8 Cedillasmall
1013 F7BF questiondownsmall
1014 F7E0 Agravesmall
1015 F7E1 Aacutesmall
1016 F7E2 Acircumflexsmall
1017 F7E3 Atildesmall
1018 F7E4 Adieresissmall
1019 F7E5 Aringsmall
1020 F7E6 AEsmall
1021 F7E7 Ccedillasmall
1022 F7E8 Egravesmall
1023 F7E9 Eacutesmall
1024 F7EA Ecircumflexsmall
1025 F7EB Edieresissmall
1026 F7EC Igravesmall
1027 F7ED Iacutesmall
1028 F7EE Icircumflexsmall
1029 F7EF Idieresissmall
1030 F7F0 Ethsmall
1031 F7F1 Ntildesmall
1032 F7F2 Ogravesmall
1033 F7F3 Oacutesmall
1034 F7F4 Ocircumflexsmall
1035 F7F5 Otildesmall
1036 F7F6 Odieresissmall
1037 F7F8 Oslashsmall
1038 F7F9 Ugravesmall
1039 F7FA Uacutesmall
1040 F7FB Ucircumflexsmall
1041 F7FC Udieresissmall
1042 F7FD Yacutesmall
1043 F7FE Thornsmall
1044 F7FF Ydieresissmall
1045 F8E5 radicalex
1046 F8E6 arrowvertex
1047 F8E7 arrowhorizex
1048 F8E8 registersans
1049 F8E9 copyrightsans
1050 F8EA trademarksans
1051 F8EB parenlefttp
1052 F8EC parenleftex
1053 F8ED parenleftbt
1054 F8EE bracketlefttp
1055 F8EF bracketleftex
1056 F8F0 bracketleftbt
1057 F8F1 bracelefttp
1058 F8F2 braceleftmid
1059 F8F3 braceleftbt
1060 F8F4 braceex
1061 F8F5 integralex
1062 F8F6 parenrighttp
1063 F8F7 parenrightex
1064 F8F8 parenrightbt
1065 F8F9 bracketrighttp
1066 F8FA bracketrightex
1067 F8FB bracketrightbt
1068 F8FC bracerighttp
1069 F8FD bracerightmid
1070 F8FE bracerightbt
1071 FB00 ff
1072 FB01 fi
1073 FB02 fl
1074 FB03 ffi
1075 FB04 ffl
1076 FB1F afii57705
1077 FB2A afii57694
1078 FB2B afii57695
1079 FB35 afii57723
1080 FB4B afii57700
1081 }
1082
1083 # precalculate entire prolog when this file is loaded
1084 # (to speed things up)
1085 set ps_preamable "%%BeginProlog\n"
1086 append ps_preamable [CreatePostscriptEncoding [encoding system]]
1087 append ps_preamable {
1088 50 dict begin
1089 % This is a standard prolog for Postscript generated by Tk's canvas
1090 % widget.
1091 % RCS: @(#) $Id: mkpsenc.tcl,v 1.3 2002/07/19 14:37:21 drh Exp $
1092
1093 % The definitions below just define all of the variables used in
1094 % any of the procedures here. This is needed for obscure reasons
1095 % explained on p. 716 of the Postscript manual (Section H.2.7,
1096 % "Initializing Variables," in the section on Encapsulated Postscript).
1097
1098 /baseline 0 def
1099 /stipimage 0 def
1100 /height 0 def
1101 /justify 0 def
1102 /lineLength 0 def
1103 /spacing 0 def
1104 /stipple 0 def
1105 /strings 0 def
1106 /xoffset 0 def
1107 /yoffset 0 def
1108 /tmpstip null def
1109
1110
1111 /cstringshow {
1112 {
1113 dup type /stringtype eq
1114 { show } { glyphshow }
1115 ifelse
31
32 # List of adobe glyph names. Converted from glyphlist.txt, downloaded from
33 # Adobe.
34
35 variable psglyphs
36 array set psglyphs {
37 0020 space
38 0021 exclam
39 0022 quotedbl
40 0023 numbersign
41 0024 dollar
42 0025 percent
43 0026 ampersand
44 0027 quotesingle
45 0028 parenleft
46 0029 parenright
47 002A asterisk
48 002B plus
49 002C comma
50 002D hyphen
51 002E period
52 002F slash
53 0030 zero
54 0031 one
55 0032 two
56 0033 three
57 0034 four
58 0035 five
59 0036 six
60 0037 seven
61 0038 eight
62 0039 nine
63 003A colon
64 003B semicolon
65 003C less
66 003D equal
67 003E greater
68 003F question
69 0040 at
70 0041 A
71 0042 B
72 0043 C
73 0044 D
74 0045 E
75 0046 F
76 0047 G
77 0048 H
78 0049 I
79 004A J
80 004B K
81 004C L
82 004D M
83 004E N
84 004F O
85 0050 P
86 0051 Q
87 0052 R
88 0053 S
89 0054 T
90 0055 U
91 0056 V
92 0057 W
93 0058 X
94 0059 Y
95 005A Z
96 005B bracketleft
97 005C backslash
98 005D bracketright
99 005E asciicircum
100 005F underscore
101 0060 grave
102 0061 a
103 0062 b
104 0063 c
105 0064 d
106 0065 e
107 0066 f
108 0067 g
109 0068 h
110 0069 i
111 006A j
112 006B k
113 006C l
114 006D m
115 006E n
116 006F o
117 0070 p
118 0071 q
119 0072 r
120 0073 s
121 0074 t
122 0075 u
123 0076 v
124 0077 w
125 0078 x
126 0079 y
127 007A z
128 007B braceleft
129 007C bar
130 007D braceright
131 007E asciitilde
132 00A0 space
133 00A1 exclamdown
134 00A2 cent
135 00A3 sterling
136 00A4 currency
137 00A5 yen
138 00A6 brokenbar
139 00A7 section
140 00A8 dieresis
141 00A9 copyright
142 00AA ordfeminine
143 00AB guillemotleft
144 00AC logicalnot
145 00AD hyphen
146 00AE registered
147 00AF macron
148 00B0 degree
149 00B1 plusminus
150 00B2 twosuperior
151 00B3 threesuperior
152 00B4 acute
153 00B5 mu
154 00B6 paragraph
155 00B7 periodcentered
156 00B8 cedilla
157 00B9 onesuperior
158 00BA ordmasculine
159 00BB guillemotright
160 00BC onequarter
161 00BD onehalf
162 00BE threequarters
163 00BF questiondown
164 00C0 Agrave
165 00C1 Aacute
166 00C2 Acircumflex
167 00C3 Atilde
168 00C4 Adieresis
169 00C5 Aring
170 00C6 AE
171 00C7 Ccedilla
172 00C8 Egrave
173 00C9 Eacute
174 00CA Ecircumflex
175 00CB Edieresis
176 00CC Igrave
177 00CD Iacute
178 00CE Icircumflex
179 00CF Idieresis
180 00D0 Eth
181 00D1 Ntilde
182 00D2 Ograve
183 00D3 Oacute
184 00D4 Ocircumflex
185 00D5 Otilde
186 00D6 Odieresis
187 00D7 multiply
188 00D8 Oslash
189 00D9 Ugrave
190 00DA Uacute
191 00DB Ucircumflex
192 00DC Udieresis
193 00DD Yacute
194 00DE Thorn
195 00DF germandbls
196 00E0 agrave
197 00E1 aacute
198 00E2 acircumflex
199 00E3 atilde
200 00E4 adieresis
201 00E5 aring
202 00E6 ae
203 00E7 ccedilla
204 00E8 egrave
205 00E9 eacute
206 00EA ecircumflex
207 00EB edieresis
208 00EC igrave
209 00ED iacute
210 00EE icircumflex
211 00EF idieresis
212 00F0 eth
213 00F1 ntilde
214 00F2 ograve
215 00F3 oacute
216 00F4 ocircumflex
217 00F5 otilde
218 00F6 odieresis
219 00F7 divide
220 00F8 oslash
221 00F9 ugrave
222 00FA uacute
223 00FB ucircumflex
224 00FC udieresis
225 00FD yacute
226 00FE thorn
227 00FF ydieresis
228 0100 Amacron
229 0101 amacron
230 0102 Abreve
231 0103 abreve
232 0104 Aogonek
233 0105 aogonek
234 0106 Cacute
235 0107 cacute
236 0108 Ccircumflex
237 0109 ccircumflex
238 010A Cdotaccent
239 010B cdotaccent
240 010C Ccaron
241 010D ccaron
242 010E Dcaron
243 010F dcaron
244 0110 Dcroat
245 0111 dcroat
246 0112 Emacron
247 0113 emacron
248 0114 Ebreve
249 0115 ebreve
250 0116 Edotaccent
251 0117 edotaccent
252 0118 Eogonek
253 0119 eogonek
254 011A Ecaron
255 011B ecaron
256 011C Gcircumflex
257 011D gcircumflex
258 011E Gbreve
259 011F gbreve
260 0120 Gdotaccent
261 0121 gdotaccent
262 0122 Gcommaaccent
263 0123 gcommaaccent
264 0124 Hcircumflex
265 0125 hcircumflex
266 0126 Hbar
267 0127 hbar
268 0128 Itilde
269 0129 itilde
270 012A Imacron
271 012B imacron
272 012C Ibreve
273 012D ibreve
274 012E Iogonek
275 012F iogonek
276 0130 Idotaccent
277 0131 dotlessi
278 0132 IJ
279 0133 ij
280 0134 Jcircumflex
281 0135 jcircumflex
282 0136 Kcommaaccent
283 0137 kcommaaccent
284 0138 kgreenlandic
285 0139 Lacute
286 013A lacute
287 013B Lcommaaccent
288 013C lcommaaccent
289 013D Lcaron
290 013E lcaron
291 013F Ldot
292 0140 ldot
293 0141 Lslash
294 0142 lslash
295 0143 Nacute
296 0144 nacute
297 0145 Ncommaaccent
298 0146 ncommaaccent
299 0147 Ncaron
300 0148 ncaron
301 0149 napostrophe
302 014A Eng
303 014B eng
304 014C Omacron
305 014D omacron
306 014E Obreve
307 014F obreve
308 0150 Ohungarumlaut
309 0151 ohungarumlaut
310 0152 OE
311 0153 oe
312 0154 Racute
313 0155 racute
314 0156 Rcommaaccent
315 0157 rcommaaccent
316 0158 Rcaron
317 0159 rcaron
318 015A Sacute
319 015B sacute
320 015C Scircumflex
321 015D scircumflex
322 015E Scedilla
323 015F scedilla
324 0160 Scaron
325 0161 scaron
326 0162 Tcommaaccent
327 0163 tcommaaccent
328 0164 Tcaron
329 0165 tcaron
330 0166 Tbar
331 0167 tbar
332 0168 Utilde
333 0169 utilde
334 016A Umacron
335 016B umacron
336 016C Ubreve
337 016D ubreve
338 016E Uring
339 016F uring
340 0170 Uhungarumlaut
341 0171 uhungarumlaut
342 0172 Uogonek
343 0173 uogonek
344 0174 Wcircumflex
345 0175 wcircumflex
346 0176 Ycircumflex
347 0177 ycircumflex
348 0178 Ydieresis
349 0179 Zacute
350 017A zacute
351 017B Zdotaccent
352 017C zdotaccent
353 017D Zcaron
354 017E zcaron
355 017F longs
356 0192 florin
357 01A0 Ohorn
358 01A1 ohorn
359 01AF Uhorn
360 01B0 uhorn
361 01E6 Gcaron
362 01E7 gcaron
363 01FA Aringacute
364 01FB aringacute
365 01FC AEacute
366 01FD aeacute
367 01FE Oslashacute
368 01FF oslashacute
369 0218 Scommaaccent
370 0219 scommaaccent
371 021A Tcommaaccent
372 021B tcommaaccent
373 02BC afii57929
374 02BD afii64937
375 02C6 circumflex
376 02C7 caron
377 02C9 macron
378 02D8 breve
379 02D9 dotaccent
380 02DA ring
381 02DB ogonek
382 02DC tilde
383 02DD hungarumlaut
384 0300 gravecomb
385 0301 acutecomb
386 0303 tildecomb
387 0309 hookabovecomb
388 0323 dotbelowcomb
389 0384 tonos
390 0385 dieresistonos
391 0386 Alphatonos
392 0387 anoteleia
393 0388 Epsilontonos
394 0389 Etatonos
395 038A Iotatonos
396 038C Omicrontonos
397 038E Upsilontonos
398 038F Omegatonos
399 0390 iotadieresistonos
400 0391 Alpha
401 0392 Beta
402 0393 Gamma
403 0394 Delta
404 0395 Epsilon
405 0396 Zeta
406 0397 Eta
407 0398 Theta
408 0399 Iota
409 039A Kappa
410 039B Lambda
411 039C Mu
412 039D Nu
413 039E Xi
414 039F Omicron
415 03A0 Pi
416 03A1 Rho
417 03A3 Sigma
418 03A4 Tau
419 03A5 Upsilon
420 03A6 Phi
421 03A7 Chi
422 03A8 Psi
423 03A9 Omega
424 03AA Iotadieresis
425 03AB Upsilondieresis
426 03AC alphatonos
427 03AD epsilontonos
428 03AE etatonos
429 03AF iotatonos
430 03B0 upsilondieresistonos
431 03B1 alpha
432 03B2 beta
433 03B3 gamma
434 03B4 delta
435 03B5 epsilon
436 03B6 zeta
437 03B7 eta
438 03B8 theta
439 03B9 iota
440 03BA kappa
441 03BB lambda
442 03BC mu
443 03BD nu
444 03BE xi
445 03BF omicron
446 03C0 pi
447 03C1 rho
448 03C2 sigma1
449 03C3 sigma
450 03C4 tau
451 03C5 upsilon
452 03C6 phi
453 03C7 chi
454 03C8 psi
455 03C9 omega
456 03CA iotadieresis
457 03CB upsilondieresis
458 03CC omicrontonos
459 03CD upsilontonos
460 03CE omegatonos
461 03D1 theta1
462 03D2 Upsilon1
463 03D5 phi1
464 03D6 omega1
465 0401 afii10023
466 0402 afii10051
467 0403 afii10052
468 0404 afii10053
469 0405 afii10054
470 0406 afii10055
471 0407 afii10056
472 0408 afii10057
473 0409 afii10058
474 040A afii10059
475 040B afii10060
476 040C afii10061
477 040E afii10062
478 040F afii10145
479 0410 afii10017
480 0411 afii10018
481 0412 afii10019
482 0413 afii10020
483 0414 afii10021
484 0415 afii10022
485 0416 afii10024
486 0417 afii10025
487 0418 afii10026
488 0419 afii10027
489 041A afii10028
490 041B afii10029
491 041C afii10030
492 041D afii10031
493 041E afii10032
494 041F afii10033
495 0420 afii10034
496 0421 afii10035
497 0422 afii10036
498 0423 afii10037
499 0424 afii10038
500 0425 afii10039
501 0426 afii10040
502 0427 afii10041
503 0428 afii10042
504 0429 afii10043
505 042A afii10044
506 042B afii10045
507 042C afii10046
508 042D afii10047
509 042E afii10048
510 042F afii10049
511 0430 afii10065
512 0431 afii10066
513 0432 afii10067
514 0433 afii10068
515 0434 afii10069
516 0435 afii10070
517 0436 afii10072
518 0437 afii10073
519 0438 afii10074
520 0439 afii10075
521 043A afii10076
522 043B afii10077
523 043C afii10078
524 043D afii10079
525 043E afii10080
526 043F afii10081
527 0440 afii10082
528 0441 afii10083
529 0442 afii10084
530 0443 afii10085
531 0444 afii10086
532 0445 afii10087
533 0446 afii10088
534 0447 afii10089
535 0448 afii10090
536 0449 afii10091
537 044A afii10092
538 044B afii10093
539 044C afii10094
540 044D afii10095
541 044E afii10096
542 044F afii10097
543 0451 afii10071
544 0452 afii10099
545 0453 afii10100
546 0454 afii10101
547 0455 afii10102
548 0456 afii10103
549 0457 afii10104
550 0458 afii10105
551 0459 afii10106
552 045A afii10107
553 045B afii10108
554 045C afii10109
555 045E afii10110
556 045F afii10193
557 0462 afii10146
558 0463 afii10194
559 0472 afii10147
560 0473 afii10195
561 0474 afii10148
562 0475 afii10196
563 0490 afii10050
564 0491 afii10098
565 04D9 afii10846
566 05B0 afii57799
567 05B1 afii57801
568 05B2 afii57800
569 05B3 afii57802
570 05B4 afii57793
571 05B5 afii57794
572 05B6 afii57795
573 05B7 afii57798
574 05B8 afii57797
575 05B9 afii57806
576 05BB afii57796
577 05BC afii57807
578 05BD afii57839
579 05BE afii57645
580 05BF afii57841
581 05C0 afii57842
582 05C1 afii57804
583 05C2 afii57803
584 05C3 afii57658
585 05D0 afii57664
586 05D1 afii57665
587 05D2 afii57666
588 05D3 afii57667
589 05D4 afii57668
590 05D5 afii57669
591 05D6 afii57670
592 05D7 afii57671
593 05D8 afii57672
594 05D9 afii57673
595 05DA afii57674
596 05DB afii57675
597 05DC afii57676
598 05DD afii57677
599 05DE afii57678
600 05DF afii57679
601 05E0 afii57680
602 05E1 afii57681
603 05E2 afii57682
604 05E3 afii57683
605 05E4 afii57684
606 05E5 afii57685
607 05E6 afii57686
608 05E7 afii57687
609 05E8 afii57688
610 05E9 afii57689
611 05EA afii57690
612 05F0 afii57716
613 05F1 afii57717
614 05F2 afii57718
615 060C afii57388
616 061B afii57403
617 061F afii57407
618 0621 afii57409
619 0622 afii57410
620 0623 afii57411
621 0624 afii57412
622 0625 afii57413
623 0626 afii57414
624 0627 afii57415
625 0628 afii57416
626 0629 afii57417
627 062A afii57418
628 062B afii57419
629 062C afii57420
630 062D afii57421
631 062E afii57422
632 062F afii57423
633 0630 afii57424
634 0631 afii57425
635 0632 afii57426
636 0633 afii57427
637 0634 afii57428
638 0635 afii57429
639 0636 afii57430
640 0637 afii57431
641 0638 afii57432
642 0639 afii57433
643 063A afii57434
644 0640 afii57440
645 0641 afii57441
646 0642 afii57442
647 0643 afii57443
648 0644 afii57444
649 0645 afii57445
650 0646 afii57446
651 0647 afii57470
652 0648 afii57448
653 0649 afii57449
654 064A afii57450
655 064B afii57451
656 064C afii57452
657 064D afii57453
658 064E afii57454
659 064F afii57455
660 0650 afii57456
661 0651 afii57457
662 0652 afii57458
663 0660 afii57392
664 0661 afii57393
665 0662 afii57394
666 0663 afii57395
667 0664 afii57396
668 0665 afii57397
669 0666 afii57398
670 0667 afii57399
671 0668 afii57400
672 0669 afii57401
673 066A afii57381
674 066D afii63167
675 0679 afii57511
676 067E afii57506
677 0686 afii57507
678 0688 afii57512
679 0691 afii57513
680 0698 afii57508
681 06A4 afii57505
682 06AF afii57509
683 06BA afii57514
684 06D2 afii57519
685 06D5 afii57534
686 1E80 Wgrave
687 1E81 wgrave
688 1E82 Wacute
689 1E83 wacute
690 1E84 Wdieresis
691 1E85 wdieresis
692 1EF2 Ygrave
693 1EF3 ygrave
694 200C afii61664
695 200D afii301
696 200E afii299
697 200F afii300
698 2012 figuredash
699 2013 endash
700 2014 emdash
701 2015 afii00208
702 2017 underscoredbl
703 2018 quoteleft
704 2019 quoteright
705 201A quotesinglbase
706 201B quotereversed
707 201C quotedblleft
708 201D quotedblright
709 201E quotedblbase
710 2020 dagger
711 2021 daggerdbl
712 2022 bullet
713 2024 onedotenleader
714 2025 twodotenleader
715 2026 ellipsis
716 202C afii61573
717 202D afii61574
718 202E afii61575
719 2030 perthousand
720 2032 minute
721 2033 second
722 2039 guilsinglleft
723 203A guilsinglright
724 203C exclamdbl
725 2044 fraction
726 2070 zerosuperior
727 2074 foursuperior
728 2075 fivesuperior
729 2076 sixsuperior
730 2077 sevensuperior
731 2078 eightsuperior
732 2079 ninesuperior
733 207D parenleftsuperior
734 207E parenrightsuperior
735 207F nsuperior
736 2080 zeroinferior
737 2081 oneinferior
738 2082 twoinferior
739 2083 threeinferior
740 2084 fourinferior
741 2085 fiveinferior
742 2086 sixinferior
743 2087 seveninferior
744 2088 eightinferior
745 2089 nineinferior
746 208D parenleftinferior
747 208E parenrightinferior
748 20A1 colonmonetary
749 20A3 franc
750 20A4 lira
751 20A7 peseta
752 20AA afii57636
753 20AB dong
754 20AC Euro
755 2105 afii61248
756 2111 Ifraktur
757 2113 afii61289
758 2116 afii61352
759 2118 weierstrass
760 211C Rfraktur
761 211E prescription
762 2122 trademark
763 2126 Omega
764 212E estimated
765 2135 aleph
766 2153 onethird
767 2154 twothirds
768 215B oneeighth
769 215C threeeighths
770 215D fiveeighths
771 215E seveneighths
772 2190 arrowleft
773 2191 arrowup
774 2192 arrowright
775 2193 arrowdown
776 2194 arrowboth
777 2195 arrowupdn
778 21A8 arrowupdnbse
779 21B5 carriagereturn
780 21D0 arrowdblleft
781 21D1 arrowdblup
782 21D2 arrowdblright
783 21D3 arrowdbldown
784 21D4 arrowdblboth
785 2200 universal
786 2202 partialdiff
787 2203 existential
788 2205 emptyset
789 2206 Delta
790 2207 gradient
791 2208 element
792 2209 notelement
793 220B suchthat
794 220F product
795 2211 summation
796 2212 minus
797 2215 fraction
798 2217 asteriskmath
799 2219 periodcentered
800 221A radical
801 221D proportional
802 221E infinity
803 221F orthogonal
804 2220 angle
805 2227 logicaland
806 2228 logicalor
807 2229 intersection
808 222A union
809 222B integral
810 2234 therefore
811 223C similar
812 2245 congruent
813 2248 approxequal
814 2260 notequal
815 2261 equivalence
816 2264 lessequal
817 2265 greaterequal
818 2282 propersubset
819 2283 propersuperset
820 2284 notsubset
821 2286 reflexsubset
822 2287 reflexsuperset
823 2295 circleplus
824 2297 circlemultiply
825 22A5 perpendicular
826 22C5 dotmath
827 2302 house
828 2310 revlogicalnot
829 2320 integraltp
830 2321 integralbt
831 2329 angleleft
832 232A angleright
833 2500 SF100000
834 2502 SF110000
835 250C SF010000
836 2510 SF030000
837 2514 SF020000
838 2518 SF040000
839 251C SF080000
840 2524 SF090000
841 252C SF060000
842 2534 SF070000
843 253C SF050000
844 2550 SF430000
845 2551 SF240000
846 2552 SF510000
847 2553 SF520000
848 2554 SF390000
849 2555 SF220000
850 2556 SF210000
851 2557 SF250000
852 2558 SF500000
853 2559 SF490000
854 255A SF380000
855 255B SF280000
856 255C SF270000
857 255D SF260000
858 255E SF360000
859 255F SF370000
860 2560 SF420000
861 2561 SF190000
862 2562 SF200000
863 2563 SF230000
864 2564 SF470000
865 2565 SF480000
866 2566 SF410000
867 2567 SF450000
868 2568 SF460000
869 2569 SF400000
870 256A SF540000
871 256B SF530000
872 256C SF440000
873 2580 upblock
874 2584 dnblock
875 2588 block
876 258C lfblock
877 2590 rtblock
878 2591 ltshade
879 2592 shade
880 2593 dkshade
881 25A0 filledbox
882 25A1 H22073
883 25AA H18543
884 25AB H18551
885 25AC filledrect
886 25B2 triagup
887 25BA triagrt
888 25BC triagdn
889 25C4 triaglf
890 25CA lozenge
891 25CB circle
892 25CF H18533
893 25D8 invbullet
894 25D9 invcircle
895 25E6 openbullet
896 263A smileface
897 263B invsmileface
898 263C sun
899 2640 female
900 2642 male
901 2660 spade
902 2663 club
903 2665 heart
904 2666 diamond
905 266A musicalnote
906 266B musicalnotedbl
907 F6BE dotlessj
908 F6BF LL
909 F6C0 ll
910 F6C1 Scedilla
911 F6C2 scedilla
912 F6C3 commaaccent
913 F6C4 afii10063
914 F6C5 afii10064
915 F6C6 afii10192
916 F6C7 afii10831
917 F6C8 afii10832
918 F6C9 Acute
919 F6CA Caron
920 F6CB Dieresis
921 F6CC DieresisAcute
922 F6CD DieresisGrave
923 F6CE Grave
924 F6CF Hungarumlaut
925 F6D0 Macron
926 F6D1 cyrBreve
927 F6D2 cyrFlex
928 F6D3 dblGrave
929 F6D4 cyrbreve
930 F6D5 cyrflex
931 F6D6 dblgrave
932 F6D7 dieresisacute
933 F6D8 dieresisgrave
934 F6D9 copyrightserif
935 F6DA registerserif
936 F6DB trademarkserif
937 F6DC onefitted
938 F6DD rupiah
939 F6DE threequartersemdash
940 F6DF centinferior
941 F6E0 centsuperior
942 F6E1 commainferior
943 F6E2 commasuperior
944 F6E3 dollarinferior
945 F6E4 dollarsuperior
946 F6E5 hypheninferior
947 F6E6 hyphensuperior
948 F6E7 periodinferior
949 F6E8 periodsuperior
950 F6E9 asuperior
951 F6EA bsuperior
952 F6EB dsuperior
953 F6EC esuperior
954 F6ED isuperior
955 F6EE lsuperior
956 F6EF msuperior
957 F6F0 osuperior
958 F6F1 rsuperior
959 F6F2 ssuperior
960 F6F3 tsuperior
961 F6F4 Brevesmall
962 F6F5 Caronsmall
963 F6F6 Circumflexsmall
964 F6F7 Dotaccentsmall
965 F6F8 Hungarumlautsmall
966 F6F9 Lslashsmall
967 F6FA OEsmall
968 F6FB Ogoneksmall
969 F6FC Ringsmall
970 F6FD Scaronsmall
971 F6FE Tildesmall
972 F6FF Zcaronsmall
973 F721 exclamsmall
974 F724 dollaroldstyle
975 F726 ampersandsmall
976 F730 zerooldstyle
977 F731 oneoldstyle
978 F732 twooldstyle
979 F733 threeoldstyle
980 F734 fouroldstyle
981 F735 fiveoldstyle
982 F736 sixoldstyle
983 F737 sevenoldstyle
984 F738 eightoldstyle
985 F739 nineoldstyle
986 F73F questionsmall
987 F760 Gravesmall
988 F761 Asmall
989 F762 Bsmall
990 F763 Csmall
991 F764 Dsmall
992 F765 Esmall
993 F766 Fsmall
994 F767 Gsmall
995 F768 Hsmall
996 F769 Ismall
997 F76A Jsmall
998 F76B Ksmall
999 F76C Lsmall
1000 F76D Msmall
1001 F76E Nsmall
1002 F76F Osmall
1003 F770 Psmall
1004 F771 Qsmall
1005 F772 Rsmall
1006 F773 Ssmall
1007 F774 Tsmall
1008 F775 Usmall
1009 F776 Vsmall
1010 F777 Wsmall
1011 F778 Xsmall
1012 F779 Ysmall
1013 F77A Zsmall
1014 F7A1 exclamdownsmall
1015 F7A2 centoldstyle
1016 F7A8 Dieresissmall
1017 F7AF Macronsmall
1018 F7B4 Acutesmall
1019 F7B8 Cedillasmall
1020 F7BF questiondownsmall
1021 F7E0 Agravesmall
1022 F7E1 Aacutesmall
1023 F7E2 Acircumflexsmall
1024 F7E3 Atildesmall
1025 F7E4 Adieresissmall
1026 F7E5 Aringsmall
1027 F7E6 AEsmall
1028 F7E7 Ccedillasmall
1029 F7E8 Egravesmall
1030 F7E9 Eacutesmall
1031 F7EA Ecircumflexsmall
1032 F7EB Edieresissmall
1033 F7EC Igravesmall
1034 F7ED Iacutesmall
1035 F7EE Icircumflexsmall
1036 F7EF Idieresissmall
1037 F7F0 Ethsmall
1038 F7F1 Ntildesmall
1039 F7F2 Ogravesmall
1040 F7F3 Oacutesmall
1041 F7F4 Ocircumflexsmall
1042 F7F5 Otildesmall
1043 F7F6 Odieresissmall
1044 F7F8 Oslashsmall
1045 F7F9 Ugravesmall
1046 F7FA Uacutesmall
1047 F7FB Ucircumflexsmall
1048 F7FC Udieresissmall
1049 F7FD Yacutesmall
1050 F7FE Thornsmall
1051 F7FF Ydieresissmall
1052 F8E5 radicalex
1053 F8E6 arrowvertex
1054 F8E7 arrowhorizex
1055 F8E8 registersans
1056 F8E9 copyrightsans
1057 F8EA trademarksans
1058 F8EB parenlefttp
1059 F8EC parenleftex
1060 F8ED parenleftbt
1061 F8EE bracketlefttp
1062 F8EF bracketleftex
1063 F8F0 bracketleftbt
1064 F8F1 bracelefttp
1065 F8F2 braceleftmid
1066 F8F3 braceleftbt
1067 F8F4 braceex
1068 F8F5 integralex
1069 F8F6 parenrighttp
1070 F8F7 parenrightex
1071 F8F8 parenrightbt
1072 F8F9 bracketrighttp
1073 F8FA bracketrightex
1074 F8FB bracketrightbt
1075 F8FC bracerighttp
1076 F8FD bracerightmid
1077 F8FE bracerightbt
1078 FB00 ff
1079 FB01 fi
1080 FB02 fl
1081 FB03 ffi
1082 FB04 ffl
1083 FB1F afii57705
1084 FB2A afii57694
1085 FB2B afii57695
1086 FB35 afii57723
1087 FB4B afii57700
11161088 }
1117 forall
1118 } bind def
1119
1120
1121
1122 /cstringwidth {
1123 0 exch 0 exch
1124 {
1125 dup type /stringtype eq
1126 { stringwidth } {
1127 currentfont /Encoding get exch 1 exch put (\001) stringwidth
1128 }
1129 ifelse
1130 exch 3 1 roll add 3 1 roll add exch
1089
1090 proc ps_literal {string} {
1091 variable ps_preamable ;# sic
1092 foreach line [split $string \n] {
1093 set line [string trim $line]
1094 if {$line eq ""} continue
1095 append ps_preamable $line \n
1096 }
1097 return
11311098 }
1132 forall
1133 } bind def
1134
1135 % font ISOEncode font
1136 % This procedure changes the encoding of a font from the default
1137 % Postscript encoding to current system encoding. It's typically invoked just
1138 % before invoking "setfont". The body of this procedure comes from
1139 % Section 5.6.1 of the Postscript book.
1140
1141 /ISOEncode {
1142 dup length dict begin
1099 proc ps_variable {name value} {
1100 variable ps_preamable
1101 append ps_preamable "/$name $value def\n"
1102 return
1103 }
1104 proc ps_function {name body} {
1105 variable ps_preamable
1106 append ps_preamable "/$name \{"
1107 foreach line [split $body \n] {
1108 set line [string trim $line]
1109 # Strip blank lines and comments from the bodies of functions
1110 if {$line eq "" } continue
1111 if {[string match {[%#]*} $line]} continue
1112 append ps_preamable $line " "
1113 }
1114 append ps_preamable "\} bind def\n"
1115 return
1116 }
1117
1118 # Precalculate entire prolog when this file is loaded (to speed things up)
1119 ps_literal {
1120 %%BeginProlog
1121 % This is a standard prolog for Postscript generated by Tk's canvas
1122 % widget.
1123 % RCS: @(#) $Id: mkpsenc.tcl,v 1.4 2008/12/05 10:27:50 dkf Exp $
1124 }
1125 ps_literal [CreatePostscriptEncoding [encoding system]]
1126 ps_literal {50 dict begin}
1127
1128 # The definitions below just define all of the variables used in any of
1129 # the procedures here. This is needed for obscure reasons explained on p.
1130 # 716 of the Postscript manual (Section H.2.7, "Initializing Variables,"
1131 # in the section on Encapsulated Postscript).
1132 ps_variable baseline 0
1133 ps_variable stipimage 0
1134 ps_variable height 0
1135 ps_variable justify 0
1136 ps_variable lineLength 0
1137 ps_variable spacing 0
1138 ps_variable stipple 0
1139 ps_variable strings 0
1140 ps_variable xoffset 0
1141 ps_variable yoffset 0
1142 ps_variable tmpstip null
1143 ps_variable baselineSampler "( TXygqPZ)"
1144 # Put an extra-tall character in; done this way to avoid encoding trouble
1145 ps_literal {baselineSampler 0 196 put}
1146
1147 ps_function cstringshow {
1148 {
1149 dup type /stringtype eq
1150 { show } { glyphshow }
1151 ifelse
1152 } forall
1153 }
1154
1155 ps_function cstringwidth {
1156 0 exch 0 exch
1157 {
1158 dup type /stringtype eq
1159 { stringwidth } {
1160 currentfont /Encoding get exch 1 exch put (\001) stringwidth
1161 }
1162 ifelse
1163 exch 3 1 roll add 3 1 roll add exch
1164 } forall
1165 }
1166
1167 # font ISOEncode font
1168 # This procedure changes the encoding of a font from the default
1169 # Postscript encoding to current system encoding. It's typically invoked
1170 # just before invoking "setfont". The body of this procedure comes from
1171 # Section 5.6.1 of the Postscript book.
1172 ps_function ISOEncode {
1173 dup length dict begin
11431174 {1 index /FID ne {def} {pop pop} ifelse} forall
11441175 /Encoding CurrentEncoding def
11451176 currentdict
1146 end
1147
1148 % I'm not sure why it's necessary to use "definefont" on this new
1149 % font, but it seems to be important; just use the name "Temporary"
1150 % for the font.
1151
1152 /Temporary exch definefont
1153 } bind def
1154
1155 % StrokeClip
1156 %
1157 % This procedure converts the current path into a clip area under
1158 % the assumption of stroking. It's a bit tricky because some Postscript
1159 % interpreters get errors during strokepath for dashed lines. If
1160 % this happens then turn off dashes and try again.
1161
1162 /StrokeClip {
1163 {strokepath} stopped {
1164 (This Postscript printer gets limitcheck overflows when) =
1165 (stippling dashed lines; lines will be printed solid instead.) =
1166 [] 0 setdash strokepath} if
1167 clip
1168 } bind def
1169
1170 % desiredSize EvenPixels closestSize
1171 %
1172 % The procedure below is used for stippling. Given the optimal size
1173 % of a dot in a stipple pattern in the current user coordinate system,
1174 % compute the closest size that is an exact multiple of the device's
1175 % pixel size. This allows stipple patterns to be displayed without
1176 % aliasing effects.
1177
1178 /EvenPixels {
1179 % Compute exact number of device pixels per stipple dot.
1180 dup 0 matrix currentmatrix dtransform
1181 dup mul exch dup mul add sqrt
1182
1183 % Round to an integer, make sure the number is at least 1, and compute
1184 % user coord distance corresponding to this.
1185 dup round dup 1 lt {pop 1} if
1186 exch div mul
1187 } bind def
1188
1189 % width height string StippleFill --
1190 %
1191 % Given a path already set up and a clipping region generated from
1192 % it, this procedure will fill the clipping region with a stipple
1193 % pattern. "String" contains a proper image description of the
1194 % stipple pattern and "width" and "height" give its dimensions. Each
1195 % stipple dot is assumed to be about one unit across in the current
1196 % user coordinate system. This procedure trashes the graphics state.
1197
1198 /StippleFill {
1199 % The following code is needed to work around a NeWSprint bug.
1200
1201 /tmpstip 1 index def
1202
1203 % Change the scaling so that one user unit in user coordinates
1204 % corresponds to the size of one stipple dot.
1205 1 EvenPixels dup scale
1206
1207 % Compute the bounding box occupied by the path (which is now
1208 % the clipping region), and round the lower coordinates down
1209 % to the nearest starting point for the stipple pattern. Be
1210 % careful about negative numbers, since the rounding works
1211 % differently on them.
1212
1213 pathbbox
1214 4 2 roll
1215 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll
1216 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll
1217
1218 % Stack now: width height string y1 y2 x1 x2
1219 % Below is a doubly-nested for loop to iterate across this area
1220 % in units of the stipple pattern size, going up columns then
1221 % across rows, blasting out a stipple-pattern-sized rectangle at
1222 % each position
1223
1224 6 index exch {
1225 2 index 5 index 3 index {
1226 % Stack now: width height string y1 y2 x y
1227
1228 gsave
1229 1 index exch translate
1230 5 index 5 index true matrix tmpstip imagemask
1231 grestore
1177 end
1178 % I'm not sure why it's necessary to use "definefont" on this new
1179 % font, but it seems to be important; just use the name "Temporary"
1180 % for the font.
1181 /Temporary exch definefont
1182 }
1183
1184 # StrokeClip
1185 #
1186 # This procedure converts the current path into a clip area under the
1187 # assumption of stroking. It's a bit tricky because some Postscript
1188 # interpreters get errors during strokepath for dashed lines. If this
1189 # happens then turn off dashes and try again.
1190 ps_function StrokeClip {
1191 {strokepath} stopped {
1192 (This Postscript printer gets limitcheck overflows when) =
1193 (stippling dashed lines; lines will be printed solid instead.) =
1194 [] 0 setdash strokepath} if
1195 clip
1196 }
1197
1198 # desiredSize EvenPixels closestSize
1199 #
1200 # The procedure below is used for stippling. Given the optimal size of a
1201 # dot in a stipple pattern in the current user coordinate system, compute
1202 # the closest size that is an exact multiple of the device's pixel size.
1203 # This allows stipple patterns to be displayed without aliasing effects.
1204 ps_function EvenPixels {
1205 % Compute exact number of device pixels per stipple dot.
1206 dup 0 matrix currentmatrix dtransform
1207 dup mul exch dup mul add sqrt
1208 % Round to an integer, make sure the number is at least 1, and compute
1209 % user coord distance corresponding to this.
1210 dup round dup 1 lt {pop 1} if
1211 exch div mul
1212 }
1213
1214 # width height string StippleFill --
1215 #
1216 # Given a path already set up and a clipping region generated from it,
1217 # this procedure will fill the clipping region with a stipple pattern.
1218 # "String" contains a proper image description of the stipple pattern and
1219 # "width" and "height" give its dimensions. Each stipple dot is assumed to
1220 # be about one unit across in the current user coordinate system. This
1221 # procedure trashes the graphics state.
1222 ps_function StippleFill {
1223 % The following code is needed to work around a NeWSprint bug.
1224 /tmpstip 1 index def
1225 % Change the scaling so that one user unit in user coordinates
1226 % corresponds to the size of one stipple dot.
1227 1 EvenPixels dup scale
1228 % Compute the bounding box occupied by the path (which is now the
1229 % clipping region), and round the lower coordinates down to the
1230 % nearest starting point for the stipple pattern. Be careful about
1231 % negative numbers, since the rounding works differently on them.
1232 pathbbox
1233 4 2 roll
1234 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll
1235 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll
1236 % Stack now: width height string y1 y2 x1 x2
1237 % Below is a doubly-nested for loop to iterate across this area
1238 % in units of the stipple pattern size, going up columns then
1239 % across rows, blasting out a stipple-pattern-sized rectangle at
1240 % each position
1241 6 index exch {
1242 2 index 5 index 3 index {
1243 % Stack now: width height string y1 y2 x y
1244 gsave
1245 1 index exch translate
1246 5 index 5 index true matrix tmpstip imagemask
1247 grestore
1248 } for
1249 pop
12321250 } for
1233 pop
1234 } for
1235 pop pop pop pop pop
1236 } bind def
1237
1238 % -- AdjustColor --
1239 % Given a color value already set for output by the caller, adjusts
1240 % that value to a grayscale or mono value if requested by the CL
1241 % variable.
1242
1243 /AdjustColor {
1244 CL 2 lt {
1245 currentgray
1246 CL 0 eq {
1247 .5 lt {0} {1} ifelse
1251 pop pop pop pop pop
1252 }
1253
1254 # -- AdjustColor --
1255 #
1256 # Given a color value already set for output by the caller, adjusts that
1257 # value to a grayscale or mono value if requested by the CL variable.
1258 ps_function AdjustColor {
1259 CL 2 lt {
1260 currentgray
1261 CL 0 eq {
1262 .5 lt {0} {1} ifelse
1263 } if
1264 setgray
12481265 } if
1249 setgray
1250 } if
1251 } bind def
1252
1253 % x y strings spacing xoffset yoffset justify stipple DrawText --
1254 % This procedure does all of the real work of drawing text. The
1255 % color and font must already have been set by the caller, and the
1256 % following arguments must be on the stack:
1257 %
1258 % x, y - Coordinates at which to draw text.
1259 % strings - An array of strings, one for each line of the text item,
1260 % in order from top to bottom.
1261 % spacing - Spacing between lines.
1262 % xoffset - Horizontal offset for text bbox relative to x and y: 0 for
1263 % nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se.
1264 % yoffset - Vertical offset for text bbox relative to x and y: 0 for
1265 % nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se.
1266 % justify - 0 for left justification, 0.5 for center, 1 for right justify.
1267 % stipple - Boolean value indicating whether or not text is to be
1268 % drawn in stippled fashion. If text is stippled,
1269 % procedure StippleText must have been defined to call
1270 % StippleFill in the right way.
1271 %
1272 % Also, when this procedure is invoked, the color and font must already
1273 % have been set for the text.
1274
1275 /DrawText {
1276 /stipple exch def
1277 /justify exch def
1278 /yoffset exch def
1279 /xoffset exch def
1280 /spacing exch def
1281 /strings exch def
1282
1283 % First scan through all of the text to find the widest line.
1284
1285 /lineLength 0 def
1286 strings {
1287 cstringwidth pop
1288 dup lineLength gt {/lineLength exch def} {pop} ifelse
1266 }
1267
1268 # x y strings spacing xoffset yoffset justify stipple DrawText --
1269 #
1270 # This procedure does all of the real work of drawing text. The color and
1271 # font must already have been set by the caller, and the following
1272 # arguments must be on the stack:
1273 #
1274 # x, y - Coordinates at which to draw text.
1275 # strings - An array of strings, one for each line of the text item, in
1276 # order from top to bottom.
1277 # spacing - Spacing between lines.
1278 # xoffset - Horizontal offset for text bbox relative to x and y: 0 for
1279 # nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se.
1280 # yoffset - Vertical offset for text bbox relative to x and y: 0 for
1281 # nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se.
1282 # justify - 0 for left justification, 0.5 for center, 1 for right justify.
1283 # stipple - Boolean value indicating whether or not text is to be drawn in
1284 # stippled fashion. If text is stippled, procedure StippleText
1285 # must have been defined to call StippleFill in the right way.
1286 #
1287 # Also, when this procedure is invoked, the color and font must already
1288 # have been set for the text.
1289 ps_function DrawText {
1290 /stipple exch def
1291 /justify exch def
1292 /yoffset exch def
1293 /xoffset exch def
1294 /spacing exch def
1295 /strings exch def
1296 % First scan through all of the text to find the widest line.
1297 /lineLength 0 def
1298 strings {
1299 cstringwidth pop
1300 dup lineLength gt {/lineLength exch def} {pop} ifelse
1301 newpath
1302 } forall
1303 % Compute the baseline offset and the actual font height.
1304 0 0 moveto baselineSampler false charpath
1305 pathbbox dup /baseline exch def
1306 exch pop exch sub /height exch def pop
12891307 newpath
1290 } forall
1291
1292 % Compute the baseline offset and the actual font height.
1293
1294 0 0 moveto (TXygqPZ) false charpath
1295 pathbbox dup /baseline exch def
1296 exch pop exch sub /height exch def pop
1297 newpath
1298
1299 % Translate coordinates first so that the origin is at the upper-left
1300 % corner of the text's bounding box. Remember that x and y for
1301 % positioning are still on the stack.
1302
1303 translate
1304 lineLength xoffset mul
1305 strings length 1 sub spacing mul height add yoffset mul translate
1306
1307 % Now use the baseline and justification information to translate so
1308 % that the origin is at the baseline and positioning point for the
1309 % first line of text.
1310
1311 justify lineLength mul baseline neg translate
1312
1313 % Iterate over each of the lines to output it. For each line,
1314 % compute its width again so it can be properly justified, then
1315 % display it.
1316
1317 strings {
1318 dup cstringwidth pop
1319 justify neg mul 0 moveto
1320 stipple {
1321
1322
1323 % The text is stippled, so turn it into a path and print
1324 % by calling StippledText, which in turn calls StippleFill.
1325 % Unfortunately, many Postscript interpreters will get
1326 % overflow errors if we try to do the whole string at
1327 % once, so do it a character at a time.
1328
1329 gsave
1330 /char (X) def
1331 {
1332 dup type /stringtype eq {
1333 % This segment is a string.
1334 {
1335 char 0 3 -1 roll put
1336 currentpoint
1337 gsave
1338 char true charpath clip StippleText
1339 grestore
1340 char stringwidth translate
1341 moveto
1342 } forall
1343 } {
1344 % This segment is glyph name
1345 % Temporary override
1346 currentfont /Encoding get exch 1 exch put
1347 currentpoint
1348 gsave (\001) true charpath clip StippleText
1349 grestore
1350 (\001) stringwidth translate
1351 moveto
1352 } ifelse
1353 } forall
1354 grestore
1355 } {cstringshow} ifelse
1356 0 spacing neg translate
1357 } forall
1358 } bind def
1359
1360 %%EndProlog
1361 }
1362
1308 % Translate and rotate coordinates first so that the origin is at the
1309 % upper-left corner of the text's bounding box. Remember that angle
1310 % for rotating, and x and y for positioning are still on the stack.
1311 translate
1312 lineLength xoffset mul
1313 strings length 1 sub spacing mul height add yoffset mul translate
1314 rotate
1315 % Now use the baseline and justification information to translate so
1316 % that the origin is at the baseline and positioning point for the
1317 % first line of text.
1318 justify lineLength mul baseline neg translate
1319 % Iterate over each of the lines to output it. For each line,
1320 % compute its width again so it can be properly justified, then
1321 % display it.
1322 strings {
1323 dup cstringwidth pop
1324 justify neg mul 0 moveto
1325 stipple {
1326 % The text is stippled, so turn it into a path and print
1327 % by calling StippledText, which in turn calls StippleFill.
1328 % Unfortunately, many Postscript interpreters will get
1329 % overflow errors if we try to do the whole string at
1330 % once, so do it a character at a time.
1331 gsave
1332 /char (X) def
1333 {
1334 dup type /stringtype eq {
1335 % This segment is a string.
1336 {
1337 char 0 3 -1 roll put
1338 currentpoint
1339 gsave
1340 char true charpath clip StippleText
1341 grestore
1342 char stringwidth translate
1343 moveto
1344 } forall
1345 } {
1346 % This segment is glyph name
1347 % Temporary override
1348 currentfont /Encoding get exch 1 exch put
1349 currentpoint
1350 gsave (\001) true charpath clip StippleText
1351 grestore
1352 (\001) stringwidth translate
1353 moveto
1354 } ifelse
1355 } forall
1356 grestore
1357 } {cstringshow} ifelse
1358 0 spacing neg translate
1359 } forall
1360 }
1361
1362 ps_literal %%EndProlog
1363
1364 rename ps_function {}
1365 rename ps_literal {}
1366 rename ps_variable {}
13631367 }
13641368
13651369 proc tk::ensure_psenc_is_loaded {} {
22 # Implements messageboxes for platforms that do not have native
33 # messagebox support.
44 #
5 # RCS: @(#) $Id: msgbox.tcl,v 1.36 2008/01/31 23:33:42 hobbs Exp $
5 # RCS: @(#) $Id: msgbox.tcl,v 1.37 2008/12/11 18:13:08 jenglish Exp $
66 #
77 # Copyright (c) 1994-1997 Sun Microsystems, Inc.
88 #
99 # See the file "license.terms" for information on usage and redistribution
1010 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 #
12
13 package require Ttk
1412
1513 # Ensure existence of ::tk::dialog namespace
1614 #
22 ::msgcat::mcset de "&About..." "&\u00dcber..."
33 ::msgcat::mcset de "All Files" "Alle Dateien"
44 ::msgcat::mcset de "Application Error" "Applikationsfehler"
5 ::msgcat::mcset de "&Apply" "&Anwenden"
6 ::msgcat::mcset de "Bold" "Fett"
7 ::msgcat::mcset de "Bold Italic" "Fett kursiv"
58 ::msgcat::mcset de "&Blue" "&Blau"
69 ::msgcat::mcset de "&Cancel" "&Abbruch"
10 ::msgcat::mcset de "Cancel" "Abbruch"
711 ::msgcat::mcset de "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kann nicht in das Verzeichnis \"%1\$s\" wechseln.\nKeine Rechte vorhanden."
812 ::msgcat::mcset de "Choose Directory" "W\u00e4hle Verzeichnis"
913 ::msgcat::mcset de "&Clear" "&R\u00fccksetzen"
1721 ::msgcat::mcset de "Directory \"%1\$s\" does not exist." "Das Verzeichnis \"%1\$s\" existiert nicht."
1822 ::msgcat::mcset de "&Directory:" "&Verzeichnis:"
1923 ::msgcat::mcset de "&Edit" "&Bearbeiten"
24 ::msgcat::mcset de "Effects" "Effekte"
2025 ::msgcat::mcset de "Error: %1\$s" "Fehler: %1\$s"
2126 ::msgcat::mcset de "E&xit" "&Ende"
2227 ::msgcat::mcset de "&File" "&Datei"
2934 ::msgcat::mcset de "Fi&les:" "Dat&eien:"
3035 ::msgcat::mcset de "&Filter"
3136 ::msgcat::mcset de "Fil&ter:"
37 ::msgcat::mcset de "Font" "Schriftart"
38 ::msgcat::mcset de "&Font:" "Schriftart:"
39 ::msgcat::mcset de "Font st&yle:" "Schriftschnitt:"
3240 ::msgcat::mcset de "&Green" "&Gr\u00fcn"
3341 ::msgcat::mcset de "&Help" "&Hilfe"
3442 ::msgcat::mcset de "Hi" "Hallo"
3543 ::msgcat::mcset de "&Hide Console" "&Konsole unsichtbar machen"
3644 ::msgcat::mcset de "&Ignore" "&Ignorieren"
3745 ::msgcat::mcset de "Invalid file name \"%1\$s\"." "Ung\u00fcltiger Dateiname \"%1\$s\"."
46 ::msgcat::mcset de "Italic" "Kursiv"
3847 ::msgcat::mcset de "Log Files" "Protokolldatei"
3948 ::msgcat::mcset de "&No" "&Nein"
49 ::msgcat::mcset de "&OK"
4050 ::msgcat::mcset de "OK"
4151 ::msgcat::mcset de "Ok"
4252 ::msgcat::mcset de "Open" "\u00d6ffnen"
4353 ::msgcat::mcset de "&Open" "\u00d6&ffnen"
44 ::msgcat::mcset de "Open Multiple Files"
54 ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien \u00F6ffnen"
4555 ::msgcat::mcset de "P&aste" "E&inf\u00fcgen"
4656 ::msgcat::mcset de "&Quit" "&Beenden"
4757 ::msgcat::mcset de "&Red" "&Rot"
58 ::msgcat::mcset de "Regular" "Standard"
4859 ::msgcat::mcset de "Replace existing file?" "Existierende Datei ersetzen?"
4960 ::msgcat::mcset de "&Retry" "&Wiederholen"
61 ::msgcat::mcset de "Sample" "Beispiel"
5062 ::msgcat::mcset de "&Save" "&Speichern"
5163 ::msgcat::mcset de "Save As" "Speichern unter"
5264 ::msgcat::mcset de "Save To Log" "In Protokoll speichern"
5365 ::msgcat::mcset de "Select Log File" "Protokolldatei ausw\u00e4hlen"
5466 ::msgcat::mcset de "Select a file to source" "Auszuf\u00fchrende Datei ausw\u00e4hlen"
5567 ::msgcat::mcset de "&Selection:" "Auswah&l:"
68 ::msgcat::mcset de "&Size:" "Schriftgrad:"
69 ::msgcat::mcset de "Show &Hidden Directories" "Zeige versteckte Dateien"
70 ::msgcat::mcset de "Show &Hidden Files and Directories" "Zeige versteckte Dateien und Verzeichnisse"
5671 ::msgcat::mcset de "Skip Messages" "Weitere Nachrichten \u00fcberspringen"
5772 ::msgcat::mcset de "&Source..." "&Ausf\u00fchren..."
73 ::msgcat::mcset de "Stri&keout" "&Durchgestrichen"
5874 ::msgcat::mcset de "Tcl Scripts" "Tcl-Skripte"
5975 ::msgcat::mcset de "Tcl for Windows" "Tcl f\u00fcr Windows"
6076 ::msgcat::mcset de "Text Files" "Textdateien"
77 ::msgcat::mcset de "&Underline" "&Unterstrichen"
6178 ::msgcat::mcset de "&Yes" "&Ja"
6279 ::msgcat::mcset de "abort" "abbrechen"
6380 ::msgcat::mcset de "blue" "blau"
22 ::msgcat::mcset en "&About..."
33 ::msgcat::mcset en "All Files"
44 ::msgcat::mcset en "Application Error"
5 ::msgcat::mcset en "&Apply"
6 ::msgcat::mcset en "Bold"
7 ::msgcat::mcset en "Bold Italic"
58 ::msgcat::mcset en "&Blue"
9 ::msgcat::mcset en "Cancel"
610 ::msgcat::mcset en "&Cancel"
711 ::msgcat::mcset en "Cannot change to the directory \"%1\$s\".\nPermission denied."
812 ::msgcat::mcset en "Choose Directory"
1721 ::msgcat::mcset en "Directory \"%1\$s\" does not exist."
1822 ::msgcat::mcset en "&Directory:"
1923 ::msgcat::mcset en "&Edit"
24 ::msgcat::mcset en "Effects"
2025 ::msgcat::mcset en "Error: %1\$s"
2126 ::msgcat::mcset en "E&xit"
2227 ::msgcat::mcset en "&File"
2934 ::msgcat::mcset en "Fi&les:"
3035 ::msgcat::mcset en "&Filter"
3136 ::msgcat::mcset en "Fil&ter:"
37 ::msgcat::mcset en "Font"
38 ::msgcat::mcset en "&Font:"
39 ::msgcat::mcset en "Font st&yle:"
3240 ::msgcat::mcset en "&Green"
3341 ::msgcat::mcset en "&Help"
3442 ::msgcat::mcset en "Hi"
3543 ::msgcat::mcset en "&Hide Console"
3644 ::msgcat::mcset en "&Ignore"
3745 ::msgcat::mcset en "Invalid file name \"%1\$s\"."
46 ::msgcat::mcset en "Italic"
3847 ::msgcat::mcset en "Log Files"
3948 ::msgcat::mcset en "&No"
4049 ::msgcat::mcset en "&OK"
50 ::msgcat::mcset en "OK"
4151 ::msgcat::mcset en "Ok"
4252 ::msgcat::mcset en "Open"
4353 ::msgcat::mcset en "&Open"
4555 ::msgcat::mcset en "P&aste"
4656 ::msgcat::mcset en "&Quit"
4757 ::msgcat::mcset en "&Red"
58 ::msgcat::mcset en "Regular"
4859 ::msgcat::mcset en "Replace existing file?"
4960 ::msgcat::mcset en "&Retry"
61 ::msgcat::mcset en "Sample"
5062 ::msgcat::mcset en "&Save"
5163 ::msgcat::mcset en "Save As"
5264 ::msgcat::mcset en "Save To Log"
5365 ::msgcat::mcset en "Select Log File"
5466 ::msgcat::mcset en "Select a file to source"
5567 ::msgcat::mcset en "&Selection:"
68 ::msgcat::mcset en "&Size:"
5669 ::msgcat::mcset en "Show &Hidden Directories"
5770 ::msgcat::mcset en "Show &Hidden Files and Directories"
5871 ::msgcat::mcset en "Skip Messages"
5972 ::msgcat::mcset en "&Source..."
73 ::msgcat::mcset en "Stri&keout"
6074 ::msgcat::mcset en "Tcl Scripts"
6175 ::msgcat::mcset en "Tcl for Windows"
6276 ::msgcat::mcset en "Text Files"
77 ::msgcat::mcset en "&Underline"
6378 ::msgcat::mcset en "&Yes"
6479 ::msgcat::mcset en "abort"
6580 ::msgcat::mcset en "blue"
275275 set auto_index(tk_getFileType) [list source [file join $dir xmfbox.tcl]]
276276 set auto_index(::tk::unsupported::ExposePrivateCommand) [list source [file join $dir unsupported.tcl]]
277277 set auto_index(::tk::unsupported::ExposePrivateVariable) [list source [file join $dir unsupported.tcl]]
278 set auto_index(::tk::fontchooser) [list source [file join $dir fontchooser.tcl]]
22 # This file defines the default bindings for Tk text widgets and provides
33 # procedures that help in implementing the bindings.
44 #
5 # RCS: @(#) $Id: text.tcl,v 1.41 2006/09/10 17:06:32 das Exp $
5 # RCS: @(#) $Id: text.tcl,v 1.42 2008/11/12 16:38:13 patthoyts Exp $
66 #
77 # Copyright (c) 1992-1994 The Regents of the University of California.
88 # Copyright (c) 1994-1997 Sun Microsystems, Inc.
3232 # char, word, or line.
3333 # x, y - Last known mouse coordinates for scanning
3434 # and auto-scanning.
35 #
3536 #-------------------------------------------------------------------------
3637
3738 #-------------------------------------------------------------------------
223224 }
224225
225226 bind Text <Control-space> {
226 %W mark set tk::anchor%W insert
227 %W mark set [tk::TextAnchor %W] insert
227228 }
228229 bind Text <Select> {
229 %W mark set tk::anchor%W insert
230 %W mark set [tk::TextAnchor %W] insert
230231 }
231232 bind Text <Control-Shift-space> {
232233 set tk::Priv(selectMode) char
526527 set Priv(selectMode) char
527528 set Priv(mouseMoved) 0
528529 set Priv(pressX) $x
530 set anchorname [tk::TextAnchor $w]
529531 $w mark set insert [TextClosestGap $w $x $y]
530 $w mark set tk::anchor$w insert
532 $w mark set $anchorname insert
531533 # Set the anchor mark's gravity depending on the click position
532534 # relative to the gap
533 set bbox [$w bbox [$w index tk::anchor$w]]
535 set bbox [$w bbox [$w index $anchorname]]
534536 if {$x > [lindex $bbox 0]} {
535 $w mark gravity tk::anchor$w right
537 $w mark gravity $anchorname right
536538 } else {
537 $w mark gravity tk::anchor$w left
539 $w mark gravity $anchorname left
538540 }
539541 # Allow focus in any case on Windows, because that will let the
540542 # selection be displayed even for state disabled text widgets.
564566 # x - Mouse x position.
565567 # y - Mouse y position.
566568
569 set ::tk::Priv(textanchoruid) 0
570
571 proc ::tk::TextAnchor {w} {
572 variable Priv
573 if {![info exists Priv(textanchor,$w)]} {
574 set Priv(textanchor,$w) tk::anchor[incr Priv(textanchoruid)]
575 }
576 return $Priv(textanchor,$w)
577 }
578
567579 proc ::tk::TextSelectTo {w x y {extend 0}} {
568580 global tcl_platform
569581 variable ::tk::Priv
570582
583 set anchorname [tk::TextAnchor $w]
571584 set cur [TextClosestGap $w $x $y]
572 if {[catch {$w index tk::anchor$w}]} {
573 $w mark set tk::anchor$w $cur
574 }
575 set anchor [$w index tk::anchor$w]
585 if {[catch {$w index $anchorname}]} {
586 $w mark set $anchorname $cur
587 }
588 set anchor [$w index $anchorname]
576589 if {[$w compare $cur != $anchor] || (abs($Priv(pressX) - $x) >= 3)} {
577590 set Priv(mouseMoved) 1
578591 }
579592 switch -- $Priv(selectMode) {
580593 char {
581 if {[$w compare $cur < tk::anchor$w]} {
594 if {[$w compare $cur < $anchorname]} {
582595 set first $cur
583 set last tk::anchor$w
596 set last $anchorname
584597 } else {
585 set first tk::anchor$w
598 set first $anchorname
586599 set last $cur
587600 }
588601 }
589602 word {
590603 # Set initial range based only on the anchor (1 char min width)
591 if {[$w mark gravity tk::anchor$w] eq "right"} {
592 set first "tk::anchor$w"
593 set last "tk::anchor$w + 1c"
604 if {[$w mark gravity $anchorname] eq "right"} {
605 set first $anchorname
606 set last "$anchorname + 1c"
594607 } else {
595 set first "tk::anchor$w - 1c"
596 set last "tk::anchor$w"
608 set first "$anchorname - 1c"
609 set last $anchorname
597610 }
598611 # Extend range (if necessary) based on the current point
599612 if {[$w compare $cur < $first]} {
608621 }
609622 line {
610623 # Set initial range based only on the anchor
611 set first "tk::anchor$w linestart"
612 set last "tk::anchor$w lineend"
624 set first "$anchorname linestart"
625 set last "$anchorname lineend"
613626
614627 # Extend range (if necessary) based on the current point
615628 if {[$w compare $cur < $first]} {
641654
642655 proc ::tk::TextKeyExtend {w index} {
643656
657 set anchorname [tk::TextAnchor $w]
644658 set cur [$w index $index]
645 if {[catch {$w index tk::anchor$w}]} {
646 $w mark set tk::anchor$w $cur
647 }
648 set anchor [$w index tk::anchor$w]
649 if {[$w compare $cur < tk::anchor$w]} {
659 if {[catch {$w index $anchorname}]} {
660 $w mark set $anchorname $cur
661 }
662 set anchor [$w index $anchorname]
663 if {[$w compare $cur < $anchorname]} {
650664 set first $cur
651 set last tk::anchor$w
665 set last $anchorname
652666 } else {
653 set first tk::anchor$w
667 set first $anchorname
654668 set last $cur
655669 }
656670 $w tag remove sel 0.0 $first
751765
752766 proc ::tk::TextKeySelect {w new} {
753767
768 set anchorname [tk::TextAnchor $w]
754769 if {[$w tag nextrange sel 1.0 end] eq ""} {
755770 if {[$w compare $new < insert]} {
756771 $w tag add sel $new insert
757772 } else {
758773 $w tag add sel insert $new
759774 }
760 $w mark set tk::anchor$w insert
775 $w mark set $anchorname insert
761776 } else {
762 if {[$w compare $new < tk::anchor$w]} {
777 if {[$w compare $new < $anchorname]} {
763778 set first $new
764 set last tk::anchor$w
779 set last $anchorname
765780 } else {
766 set first tk::anchor$w
781 set first $anchorname
767782 set last $new
768783 }
769784 $w tag remove sel 1.0 $first
797812 # the two clicks will be selected. [Bug: 5929].
798813 return
799814 }
815 set anchorname [tk::TextAnchor $w]
800816 set a [$w index $index]
801817 set b [$w index sel.first]
802818 set c [$w index sel.last]
803819 if {[$w compare $a < $b]} {
804 $w mark set tk::anchor$w sel.last
820 $w mark set $anchorname sel.last
805821 return
806822 }
807823 if {[$w compare $a > $c]} {
808 $w mark set tk::anchor$w sel.first
824 $w mark set $anchorname sel.first
809825 return
810826 }
811827 scan $a "%d.%d" lineA chA
817833 return
818834 }
819835 if {[string length [$w get $b $a]] < ($total/2)} {
820 $w mark set tk::anchor$w sel.last
836 $w mark set $anchorname sel.last
821837 } else {
822 $w mark set tk::anchor$w sel.first
838 $w mark set $anchorname sel.first
823839 }
824840 return
825841 }
826842 if {($lineA-$lineB) < ($lineC-$lineA)} {
827 $w mark set tk::anchor$w sel.last
843 $w mark set $anchorname sel.last
828844 } else {
829 $w mark set tk::anchor$w sel.first
845 $w mark set $anchorname sel.first
830846 }
831847 }
832848
22 # Initialization script normally executed in the interpreter for each
33 # Tk-based application. Arranges class bindings for widgets.
44 #
5 # RCS: @(#) $Id: tk.tcl,v 1.79 2008/08/28 16:29:34 dgp Exp $
5 # RCS: @(#) $Id: tk.tcl,v 1.81 2008/12/19 14:32:25 dgp Exp $
66 #
77 # Copyright (c) 1992-1994 The Regents of the University of California.
88 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
1414 # Insist on running with compatible version of Tcl
1515 package require Tcl 8.6
1616 # Verify that we have Tk binary and script components from the same release
17 package require -exact Tk 8.6a3
17 package require -exact Tk 8.6b1
1818
1919 # Create a ::tk namespace
2020 namespace eval ::tk {
1010 # files by clicking on the file icons or by entering a filename
1111 # in the "Filename:" entry.
1212 #
13 # RCS: @(#) $Id: tkfbox.tcl,v 1.69 2008/08/25 17:13:04 tmh Exp $
13 # RCS: @(#) $Id: tkfbox.tcl,v 1.70 2008/12/11 18:13:08 jenglish Exp $
1414 #
1515 # Copyright (c) 1994-1998 Sun Microsystems, Inc.
1616 #
1717 # See the file "license.terms" for information on usage and redistribution
1818 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1919 #
20
21 package require Ttk
2220
2321 #----------------------------------------------------------------------
2422 #
00 #
1 # $Id: altTheme.tcl,v 1.7 2008/05/23 20:20:05 jenglish Exp $
1 # $Id: altTheme.tcl,v 1.9 2008/11/29 00:43:48 patthoyts Exp $
22 #
33 # Ttk widget set: Alternate theme
44 #
5858 ttk::style configure TCombobox -padding 1
5959 ttk::style map TCombobox -fieldbackground \
6060 [list readonly $colors(-frame) disabled $colors(-frame)]
61 ttk::style configure ComboboxPopdownFrame \
62 -relief solid -borderwidth 1
63
64 ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
65 ttk::style map TSpinbox -fieldbackground \
66 [list readonly $colors(-frame) disabled $colors(-frame)] \
67 -arrowcolor [list disabled $colors(-disabledfg)]
6168
6269 ttk::style configure Toolbutton -relief flat -padding 2
6370 ttk::style map Toolbutton -relief \
00 #
1 # $Id: clamTheme.tcl,v 1.7 2008/05/23 20:20:06 jenglish Exp $
1 # $Id: clamTheme.tcl,v 1.10 2008/12/07 18:42:55 jenglish Exp $
22 #
33 # "Clam" theme.
44 #
104104 readonly $colors(-frame)] \
105105 -foreground [list {readonly focus} $colors(-selectfg)] \
106106 ;
107 ttk::style configure ComboboxPopdownFrame \
108 -relief solid -borderwidth 1
109
110 ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
111 ttk::style map TSpinbox \
112 -background [list readonly $colors(-frame)] \
113 -arrowcolor [list disabled $colors(-disabledfg)]
107114
108115 ttk::style configure TNotebook.Tab -padding {6 2 6 2}
109116 ttk::style map TNotebook.Tab \
00 #
1 # $Id: classicTheme.tcl,v 1.7 2008/05/23 20:20:06 jenglish Exp $
1 # $Id: classicTheme.tcl,v 1.9 2008/11/29 00:43:48 patthoyts Exp $
22 #
33 # "classic" Tk theme.
44 #
6969 ttk::style configure TCombobox -padding 1
7070 ttk::style map TCombobox -fieldbackground \
7171 [list readonly $colors(-frame) disabled $colors(-frame)]
72 ttk::style configure ComboboxPopdownFrame \
73 -relief solid -borderwidth 1
74
75 ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
76 ttk::style map TSpinbox -fieldbackground \
77 [list readonly $colors(-frame) disabled $colors(-frame)]
7278
7379 ttk::style configure TLabelframe -borderwidth 2 -relief groove
7480
00 #
1 # $Id: combobox.tcl,v 1.12 2008/02/23 18:41:07 jenglish Exp $
1 # $Id: combobox.tcl,v 1.18 2008/12/07 21:24:12 jenglish Exp $
22 #
33 # Combobox bindings.
4 #
5 # Each combobox $cb has a child $cb.popdown, which contains
6 # a listbox $cb.popdown.l and a scrollbar. The listbox -listvariable
7 # is set to a namespace variable, which is used to synchronize the
8 # combobox values with the listbox values.
94 #
105 # <<NOTE-WM-TRANSIENT>>:
116 #
5954 bind TCombobox <Double-ButtonPress-1> { ttk::combobox::Press "2" %W %x %y }
6055 bind TCombobox <Triple-ButtonPress-1> { ttk::combobox::Press "3" %W %x %y }
6156 bind TCombobox <B1-Motion> { ttk::combobox::Drag %W %x }
62
63 bind TCombobox <MouseWheel> { ttk::combobox::Scroll %W [expr {%D/-120}] }
64 if {[tk windowingsystem] eq "x11"} {
65 bind TCombobox <ButtonPress-4> { ttk::combobox::Scroll %W -1 }
66 bind TCombobox <ButtonPress-5> { ttk::combobox::Scroll %W 1 }
67 }
57 bind TCombobox <Motion> { ttk::combobox::Motion %W %x %y }
58
59 ttk::bindMouseWheel TCombobox [list ttk::combobox::Scroll %W]
6860
6961 bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W }
7062
151143 }
152144 }
153145
146 ## Motion --
147 # Set cursor.
148 #
149 proc ttk::combobox::Motion {w x y} {
150 if { [$w identify $x $y] eq "textarea"
151 && [$w instate {!readonly !disabled}]
152 } {
153 ttk::setCursor $w text
154 } else {
155 ttk::setCursor $w ""
156 }
157 }
158
154159 ## TraverseIn -- receive focus due to keyboard navigation
155160 # For editable comboboxes, set the selection and insert cursor.
156161 #
264269 variable scrollbar
265270
266271 if {![winfo exists $cb.popdown]} {
267 set popdown [PopdownToplevel $cb.popdown]
272 set poplevel [PopdownToplevel $cb.popdown]
273
274 set popdown [ttk::frame $poplevel.f -style ComboboxPopdownFrame]
268275
269276 $scrollbar $popdown.sb \
270277 -orient vertical -command [list $popdown.l yview]
279286 bindtags $popdown.l \
280287 [list $popdown.l ComboboxListbox Listbox $popdown all]
281288
282 grid $popdown.l $popdown.sb -sticky news
289 grid $popdown.l -row 0 -column 0 -padx {1 0} -pady 1 -sticky nsew
290 grid $popdown.sb -row 0 -column 1 -padx {0 1} -pady 1 -sticky ns
283291 grid columnconfigure $popdown 0 -weight 1
284292 grid rowconfigure $popdown 0 -weight 1
293
294 grid $popdown -sticky news -padx 0 -pady 0
295 grid rowconfigure $poplevel 0 -weight 1
296 grid columnconfigure $poplevel 0 -weight 1
285297 }
286298 return $cb.popdown
287299 }
296308 switch -- [tk windowingsystem] {
297309 default -
298310 x11 {
299 $w configure -relief solid -borderwidth 1
311 $w configure -relief flat -borderwidth 0
300312 wm overrideredirect $w true
301313 }
302314 win32 {
303 $w configure -relief solid -borderwidth 1
315 $w configure -relief flat -borderwidth 0
304316 wm overrideredirect $w true
317 wm attributes $w -topmost 1
305318 }
306319 aqua {
307320 $w configure -relief solid -borderwidth 0
320333 proc ttk::combobox::ConfigureListbox {cb} {
321334 variable Values
322335
323 set popdown [PopdownWindow $cb]
336 set popdown [PopdownWindow $cb].f
324337 set values [$cb cget -values]
325338 set current [$cb current]
326339 if {$current < 0} {
335348 if {$height > [$cb cget -height]} {
336349 set height [$cb cget -height]
337350 grid $popdown.sb
351 grid configure $popdown.l -padx {1 0}
338352 } else {
339353 grid remove $popdown.sb
354 grid configure $popdown.l -padx 1
340355 }
341356 $popdown.l configure -height $height
342357 }
390405
391406 # Post the listbox:
392407 #
408 wm attribute $popdown -topmost 1
393409 wm deiconify $popdown
394410 raise $popdown
395411 }
408424 # Return the combobox main widget that owns the listbox.
409425 #
410426 proc ttk::combobox::LBMaster {lb} {
411 winfo parent [winfo parent $lb]
427 winfo parent [winfo parent [winfo parent $lb]]
412428 }
413429
414430 ## LBSelect $lb --
00 #
1 # $Id: cursors.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
1 # $Id: cursors.tcl,v 1.2 2008/10/28 20:02:03 jenglish Exp $
22 #
3 # Ttk package: Symbolic cursor names.
3 # Map symbolic cursor names to platform-appropriate cursors.
44 #
5 # @@@ TODO: Figure out appropriate platform-specific cursors
6 # for the various functions.
5 # The following cursors are defined:
6 #
7 # standard -- default cursor for most controls
8 # "" -- inherit cursor from parent window
9 # none -- no cursor
10 #
11 # text -- editable widgets (entry, text)
12 # link -- hyperlinks within text
13 # crosshair -- graphic selection, fine control
14 # busy -- operation in progress
15 # forbidden -- action not allowed
16 #
17 # hresize -- horizontal resizing
18 # vresize -- vertical resizing
19 #
20 # Also resize cursors for each of the compass points,
21 # {nw,n,ne,w,e,sw,s,se}resize.
22 #
23 # Platform notes:
24 #
25 # Windows doesn't distinguish resizing at the 8 compass points,
26 # only horizontal, vertical, and the two diagonals.
27 #
28 # OSX doesn't have resize cursors for nw, ne, sw, or se corners.
29 # We use the Tk-defined X11 fallbacks for these.
30 #
31 # X11 doesn't have a "forbidden" cursor (usually a slashed circle);
32 # "pirate" seems to be the conventional cursor for this purpose.
33 #
34 # Windows has an IDC_HELP cursor, but it's not available from Tk.
35 #
36 # Tk does not support "none" on Windows.
737 #
838
939 namespace eval ttk {
1040
1141 variable Cursors
1242
13 switch -glob $::tcl_platform(platform) {
14 "windows" {
43 # Use X11 cursor names as defaults, since Tk supplies these
44 # on all platforms.
45 #
46 array set Cursors {
47 "" ""
48 none none
49
50 standard left_ptr
51 text xterm
52 link hand2
53 crosshair crosshair
54 busy watch
55 forbidden pirate
56
57 hresize sb_h_double_arrow
58 vresize sb_v_double_arrow
59
60 nresize top_side
61 sresize bottom_side
62 wresize left_side
63 eresize right_side
64 nwresize top_left_corner
65 neresize top_right_corner
66 swresize bottom_left_corner
67 seresize bottom_right_corner
68 move fleur
69
70 }
71
72 # Platform-specific overrides for Windows and OSX.
73 #
74 switch [tk windowingsystem] {
75 "win32" {
1576 array set Cursors {
16 hresize sb_h_double_arrow
17 vresize sb_v_double_arrow
77 none {}
78
79 standard arrow
80 text ibeam
81 link hand2
82 crosshair crosshair
83 busy wait
84 forbidden no
85
86 vresize size_ns
87 nresize size_ns
88 sresize size_ns
89
90 wresize size_we
91 eresize size_we
92 hresize size_we
93
94 nwresize size_nw_se
95 swresize size_ne_sw
96
97 neresize size_ne_sw
1898 seresize size_nw_se
1999 }
20100 }
21101
22 "unix" -
23 * {
24 array set Cursors {
25 hresize sb_h_double_arrow
26 vresize sb_v_double_arrow
27 seresize bottom_right_corner
102 "aqua" {
103 if {[package vsatisfies [package provide Tk] 8.5]} {
104 # appeared 2007-04-23, Tk 8.5a6
105 array set Cursors {
106 standard arrow
107 text ibeam
108 link pointinghand
109 crosshair crosshair
110 busy watch
111 forbidden notallowed
112
113 hresize resizeleftright
114 vresize resizeupdown
115 nresize resizeup
116 sresize resizedown
117 wresize resizeleft
118 eresize resizeright
119 }
28120 }
29121 }
30
31122 }
32123 }
33124
125 ## ttk::cursor $cursor --
126 # Return platform-specific cursor for specified symbolic cursor.
127 #
128 proc ttk::cursor {name} {
129 variable Cursors
130 return $Cursors($name)
131 }
132
133 ## ttk::setCursor $w $cursor --
134 # Set the cursor for specified window.
135 #
136 # [ttk::setCursor] should be used in <Motion> bindings
137 # instead of directly calling [$w configure -cursor ...],
138 # as the latter always incurs a server round-trip and
139 # can lead to high CPU load (see [#1184746])
140 #
141
142 proc ttk::setCursor {w name} {
143 variable Cursors
144 if {[$w cget -cursor] ne $Cursors($name)} {
145 $w configure -cursor $Cursors($name)
146 }
147 }
148
149 ## Interactive test harness:
150 #
151 proc ttk::CursorSampler {f} {
152 ttk::frame $f
153
154 set r 0
155 foreach row {
156 {nwresize nresize neresize}
157 { wresize move eresize}
158 {swresize sresize seresize}
159 {text link crosshair}
160 {hresize vresize ""}
161 {busy forbidden ""}
162 {none standard ""}
163 } {
164 set c 0
165 foreach cursor $row {
166 set w $f.${r}${c}
167 ttk::label $w -text $cursor -cursor [ttk::cursor $cursor] \
168 -relief solid -borderwidth 1 -padding 3
169 grid $w -row $r -column $c -sticky nswe
170 grid columnconfigure $f $c -uniform cols -weight 1
171 incr c
172 }
173 grid rowconfigure $f $r -uniform rows -weight 1
174 incr r
175 }
176
177 return $f
178 }
179
180 if {[info exists argv0] && $argv0 eq [info script]} {
181 wm title . "[array size ::ttk::Cursors] cursors"
182 pack [ttk::CursorSampler .f] -expand true -fill both
183 bind . <KeyPress-Escape> [list destroy .]
184 focus .f
185 }
186
34187 #*EOF*
00 #
1 # $Id: defaults.tcl,v 1.7 2008/05/23 20:20:06 jenglish Exp $
1 # $Id: defaults.tcl,v 1.9 2008/11/29 00:43:48 patthoyts Exp $
22 #
33 # Settings for default theme.
44 #
6565 ttk::style map TCombobox -fieldbackground \
6666 [list readonly $colors(-frame) disabled $colors(-frame)]
6767
68 ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
69 ttk::style map TSpinbox -fieldbackground \
70 [list readonly $colors(-frame) disabled $colors(-frame)] \
71 -arrowcolor [list disabled $colors(-disabledfg)]
72
6873 ttk::style configure TLabelframe \
6974 -relief groove -borderwidth 2
7075
9398 -background [list selected $colors(-selectbg)] \
9499 -foreground [list selected $colors(-selectfg)] ;
95100
101 # Combobox popdown frame
102 ttk::style layout ComboboxPopdownFrame {
103 ComboboxPopdownFrame.border -sticky nswe
104 }
105 ttk::style configure ComboboxPopdownFrame \
106 -borderwidth 1 -relief solid
107
96108 #
97109 # Toolbar buttons:
98110 #
00 #
1 # $Id: entry.tcl,v 1.4 2007/12/13 15:27:08 dgp Exp $
1 # $Id: entry.tcl,v 1.6 2008/11/01 15:34:24 patthoyts Exp $
22 #
33 # DERIVED FROM: tk/library/entry.tcl r1.22
44 #
3232 set State(deadband) 3 ;# #pixels for mouse-moved deadband.
3333 }
3434 }
35
36 ### Option database settings.
37 #
38 option add *TEntry.cursor [ttk::cursor text]
3539
3640 ### Bindings.
3741 #
223227 # position following the next end-of-word position.
224228 #
225229 set ::ttk::entry::State(startNext) \
226 [string equal $tcl_platform(platform) "windows"]
230 [string equal $::tcl_platform(platform) "windows"]
227231
228232 proc ttk::entry::NextWord {w start} {
229233 variable State
00 #
1 # $Id: panedwindow.tcl,v 1.5 2007/12/13 15:27:08 dgp Exp $
1 # $Id: panedwindow.tcl,v 1.6 2008/10/28 20:02:03 jenglish Exp $
22 #
33 # Bindings for ttk::panedwindow widget.
44 #
2525 bind TPanedwindow <Leave> { ttk::panedwindow::ResetCursor %W }
2626 # See <<NOTE-PW-LEAVE-NOTIFYINFERIOR>>
2727 bind TPanedwindow <<EnteredChild>> { ttk::panedwindow::ResetCursor %W }
28
2928
3029 ## Sash movement:
3130 #
6564 proc ttk::panedwindow::ResetCursor {w} {
6665 variable State
6766 if {!$State(pressed)} {
68 $w configure -cursor {}
67 ttk::setCursor $w {}
6968 }
7069 }
7170
7271 proc ttk::panedwindow::SetCursor {w x y} {
73 variable ::ttk::Cursors
74
75 if {![llength [$w identify $x $y]]} {
76 ResetCursor $w
77 } else {
72 set cursor ""
73 if {[llength [$w identify $x $y]]} {
7874 # Assume we're over a sash.
7975 switch -- [$w cget -orient] {
80 horizontal { $w configure -cursor $Cursors(hresize) }
81 vertical { $w configure -cursor $Cursors(vresize) }
76 horizontal { set cursor hresize }
77 vertical { set cursor vresize }
8278 }
8379 }
80 ttk::setCursor $w $cursor
8481 }
8582
8683 #*EOF*
11 #
22 # Bindings for the TScale widget
33 #
4 # $Id: scale.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
4 # $Id: scale.tcl,v 1.2 2008/10/17 12:29:25 patthoyts Exp $
55
66 namespace eval ttk::scale {
77 variable State
1414 bind TScale <B1-Motion> { ttk::scale::Drag %W %x %y }
1515 bind TScale <ButtonRelease-1> { ttk::scale::Release %W %x %y }
1616
17 bind TScale <ButtonPress-2> { ttk::scale::Jump %W %x %y }
18 bind TScale <B2-Motion> { ttk::scale::Drag %W %x %y }
19 bind TScale <ButtonRelease-2> { ttk::scale::Release %W %x %y }
20
21 bind TScale <ButtonPress-3> { ttk::scale::Jump %W %x %y }
22 bind TScale <B3-Motion> { ttk::scale::Drag %W %x %y }
23 bind TScale <ButtonRelease-3> { ttk::scale::Release %W %x %y }
24
25 bind TScale <Left> { ttk::scale::Increment %W -1 }
26 bind TScale <Up> { ttk::scale::Increment %W -1 }
27 bind TScale <Right> { ttk::scale::Increment %W 1 }
28 bind TScale <Down> { ttk::scale::Increment %W 1 }
29 bind TScale <Control-Left> { ttk::scale::Increment %W -10 }
30 bind TScale <Control-Up> { ttk::scale::Increment %W -10 }
31 bind TScale <Control-Right> { ttk::scale::Increment %W 10 }
32 bind TScale <Control-Down> { ttk::scale::Increment %W 10 }
33 bind TScale <Home> { %W set [%W cget -from] }
34 bind TScale <End> { %W set [%W cget -to] }
35
1736 proc ttk::scale::Press {w x y} {
1837 variable State
1938 set State(dragging) 0
2140 switch -glob -- [$w identify $x $y] {
2241 *track -
2342 *trough {
24 if {[$w get $x $y] <= [$w get]} {
25 ttk::Repeatedly Increment $w -1
26 } else {
27 ttk::Repeatedly Increment $w 1
28 }
43 set inc [expr {([$w get $x $y] <= [$w get]) ? -1 : 1}]
44 ttk::Repeatedly Increment $w $inc
2945 }
3046 *slider {
3147 set State(dragging) 1
3248 set State(initial) [$w get]
49 }
50 }
51 }
52
53 # scale::Jump -- ButtonPress-2/3 binding for scale acts like
54 # Press except that clicking in the trough jumps to the
55 # clicked position.
56 proc ttk::scale::Jump {w x y} {
57 variable State
58 set State(dragging) 0
59
60 switch -glob -- [$w identify $x $y] {
61 *track -
62 *trough {
63 $w set [$w get $x $y]
64 set State(dragging) 1
65 set State(initial) [$w get]
66 }
67 *slider {
68 Press $w $x $y
3369 }
3470 }
3571 }
00 #
1 # $Id: sizegrip.tcl,v 1.2 2008/04/04 14:18:30 patthoyts Exp $
1 # $Id: sizegrip.tcl,v 1.3 2008/10/28 20:02:03 jenglish Exp $
22 #
3 # Ttk widget set -- sizegrip widget bindings.
3 # Sizegrip widget bindings.
44 #
55 # Dragging a sizegrip widget resizes the containing toplevel.
66 #
77 # NOTE: the sizegrip widget must be in the lower right hand corner.
88 #
99
10 option add *TSizegrip.cursor $::ttk::Cursors(seresize)
10 switch -- [tk windowingsystem] {
11 x11 -
12 win32 {
13 option add *TSizegrip.cursor [ttk::cursor seresize]
14 }
15 aqua {
16 # Aqua sizegrips use default Arrow cursor.
17 }
18 }
1119
1220 namespace eval ttk::sizegrip {
1321 variable State
0 #
1 # $Id: spinbox.tcl,v 1.3 2008/12/07 21:24:12 jenglish Exp $
2 #
3 # ttk::spinbox bindings
4 #
5
6 namespace eval ttk::spinbox { }
7
8 ### Spinbox bindings.
9 #
10 # Duplicate the Entry bindings, override if needed:
11 #
12
13 ttk::copyBindings TEntry TSpinbox
14
15 bind TSpinbox <Motion> { ttk::spinbox::Motion %W %x %y }
16 bind TSpinbox <ButtonPress-1> { ttk::spinbox::Press %W %x %y }
17 bind TSpinbox <ButtonRelease-1> { ttk::spinbox::Release %W }
18 bind TSpinbox <Double-Button-1> { ttk::spinbox::DoubleClick %W %x %y }
19 bind TSpinbox <Triple-Button-1> {} ;# disable TEntry triple-click
20
21 bind TSpinbox <KeyPress-Up> { event generate %W <<Increment>> }
22 bind TSpinbox <KeyPress-Down> { event generate %W <<Decrement>> }
23
24 bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 }
25 bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 }
26
27 ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W]
28
29 ## Motion --
30 # Sets cursor.
31 #
32 proc ttk::spinbox::Motion {w x y} {
33 if { [$w identify $x $y] eq "textarea"
34 && [$w instate {!readonly !disabled}]
35 } {
36 ttk::setCursor $w text
37 } else {
38 ttk::setCursor $w ""
39 }
40 }
41
42 ## Press --
43 #
44 proc ttk::spinbox::Press {w x y} {
45 if {[$w instate disabled]} { return }
46 focus $w
47 switch -glob -- [$w identify $x $y] {
48 *textarea { ttk::entry::Press $w $x }
49 *rightarrow -
50 *uparrow { ttk::Repeatedly event generate $w <<Increment>> }
51 *leftarrow -
52 *downarrow { ttk::Repeatedly event generate $w <<Decrement>> }
53 *spinbutton {
54 if {$y * 2 >= [winfo height $w]} {
55 set event <<Decrement>>
56 } else {
57 set event <<Increment>>
58 }
59 ttk::Repeatedly event generate $w $event
60 }
61 }
62 }
63
64 ## DoubleClick --
65 # Select all if over the text area; otherwise same as Press.
66 #
67 proc ttk::spinbox::DoubleClick {w x y} {
68 if {[$w instate disabled]} { return }
69
70 switch -glob -- [$w identify $x $y] {
71 *textarea { SelectAll $w }
72 * { Press $w $x $y }
73 }
74 }
75
76 proc ttk::spinbox::Release {w} {
77 ttk::CancelRepeat
78 }
79
80 ## MouseWheel --
81 # Mousewheel callback. Turn these into <<Increment>> (-1, up)
82 # or <<Decrement> (+1, down) events.
83 #
84 proc ttk::spinbox::MouseWheel {w dir} {
85 if {$dir < 0} {
86 event generate $w <<Increment>>
87 } else {
88 event generate $w <<Decrement>>
89 }
90 }
91
92 ## SelectAll --
93 # Select widget contents.
94 #
95 proc ttk::spinbox::SelectAll {w} {
96 $w selection range 0 end
97 $w icursor end
98 }
99
100 ## Limit --
101 # Limit $v to lie between $min and $max
102 #
103 proc ttk::spinbox::Limit {v min max} {
104 if {$v < $min} { return $min }
105 if {$v > $max} { return $max }
106 return $v
107 }
108
109 ## Wrap --
110 # Adjust $v to lie between $min and $max, wrapping if out of bounds.
111 #
112 proc ttk::spinbox::Wrap {v min max} {
113 if {$v < $min} { return $max }
114 if {$v > $max} { return $min }
115 return $v
116 }
117
118 ## Adjust --
119 # Limit or wrap spinbox value depending on -wrap.
120 #
121 proc ttk::spinbox::Adjust {w v min max} {
122 if {[$w cget -wrap]} {
123 return [Wrap $v $min $max]
124 } else {
125 return [Limit $v $min $max]
126 }
127 }
128
129 ## Spin --
130 # Handle <<Increment>> and <<Decrement>> events.
131 # If -values is specified, cycle through the list.
132 # Otherwise cycle through numeric range based on
133 # -from, -to, and -increment.
134 #
135 proc ttk::spinbox::Spin {w dir} {
136 set nvalues [llength [set values [$w cget -values]]]
137 set value [$w get]
138 if {$nvalues} {
139 set current [lsearch -exact $values $value]
140 set index [Adjust $w [expr {$current + $dir}] 0 [expr {$nvalues - 1}]]
141 $w set [lindex $values $index]
142 } else {
143 if {[catch {
144 set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
145 }]} {
146 set v [$w cget -from]
147 }
148 $w set [FormatValue $w [Adjust $w $v [$w cget -from] [$w cget -to]]]
149 }
150 SelectAll $w
151 uplevel #0 [$w cget -command]
152 }
153
154 ## FormatValue --
155 # Reformat numeric value based on -format.
156 #
157 proc ttk::spinbox::FormatValue {w val} {
158 set fmt [$w cget -format]
159 if {$fmt eq ""} {
160 # Try to guess a suitable -format based on -increment.
161 set delta [expr {abs([$w cget -increment])}]
162 if {0 < $delta && $delta < 1} {
163 # NB: This guesses wrong if -increment has more than 1
164 # significant digit itself, e.g., -increment 0.25
165 set nsd [expr {int(ceil(-log10($delta)))}]
166 set fmt "%.${nsd}f"
167 } else {
168 set fmt "%.0f"
169 }
170 }
171 return [format $fmt $val]
172 }
173
174 #*EOF*
0 # $Id: treeview.tcl,v 1.6 2008/05/23 20:20:06 jenglish Exp $
0 # $Id: treeview.tcl,v 1.7 2008/10/28 20:02:03 jenglish Exp $
11 #
22 # ttk::treeview widget bindings and utilities.
33 #
102102 # Sets cursor, active element ...
103103 #
104104 proc ttk::treeview::Motion {w x y} {
105 variable ::ttk::Cursors
106 variable State
107
108105 set cursor {}
109106 set activeHeading {}
110107
111108 switch -- [$w identify region $x $y] {
112 separator { set cursor $Cursors(hresize) }
109 separator { set cursor hresize }
113110 heading { set activeHeading [$w identify column $x $y] }
114111 }
115112
116 if {[$w cget -cursor] ne $cursor} {
117 $w configure -cursor $cursor
118 }
113 ttk::setCursor $w $cursor
119114 ActivateHeading $w $activeHeading
120115 }
121116
00 #
1 # $Id: ttk.tcl,v 1.8 2007/12/13 15:27:08 dgp Exp $
1 # $Id: ttk.tcl,v 1.10 2008/12/05 11:11:58 patthoyts Exp $
22 #
33 # Ttk widget set initialization script.
44 #
104104 source [file join $::ttk::library panedwindow.tcl]
105105 source [file join $::ttk::library entry.tcl]
106106 source [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl
107 source [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl
107108 source [file join $::ttk::library treeview.tcl]
108109 source [file join $::ttk::library sizegrip.tcl]
109110
122123 uplevel #0 [list source [file join $library defaults.tcl]]
123124
124125 set builtinThemes [style theme names]
125 foreach {theme script} {
126 foreach {theme scripts} {
126127 classic classicTheme.tcl
127128 alt altTheme.tcl
128129 clam clamTheme.tcl
129130 winnative winTheme.tcl
130 xpnative xpTheme.tcl
131 xpnative {xpTheme.tcl vistaTheme.tcl}
131132 aqua aquaTheme.tcl
132133 } {
133134 if {[lsearch -exact $builtinThemes $theme] >= 0} {
134 uplevel #0 [list source [file join $library $script]]
135 foreach script $scripts {
136 uplevel #0 [list source [file join $library $script]]
137 }
135138 }
136139 }
137140 }
149152 #
150153
151154 proc ttk::DefaultTheme {} {
152 set preferred [list aqua xpnative winnative]
155 set preferred [list aqua vista xpnative winnative]
153156
154157 set userTheme [option get . tkTheme TkTheme]
155 if {$userTheme != {} && ![catch {
158 if {$userTheme ne {} && ![catch {
156159 uplevel #0 [list package require ttk::theme::$userTheme]
157160 }]} {
158161 return $userTheme
159162 }
160163
161164 foreach theme $preferred {
162 if {[package provide ttk::theme::$theme] != ""} {
165 if {[package provide ttk::theme::$theme] ne ""} {
163166 return $theme
164167 }
165168 }
00 #
1 # $Id: utils.tcl,v 1.6 2008/01/06 19:16:12 jenglish Exp $
1 # $Id: utils.tcl,v 1.7 2008/12/07 21:24:12 jenglish Exp $
22 #
33 # Utilities for widget implementations.
44 #
250250 }
251251 }
252252
253 ## Standard mousewheel bindings.
254 #
255 # Usage: [ttk::copyBindings TtkScrollable $bindtag]
256 # adds mousewheel support to a scrollable widget.
253 ### Mousewheel bindings.
257254 #
258255 # Platform inconsistencies:
259256 #
275272 # MouseWheel scrolling is accelerated on X11, which is conventional
276273 # for Tk and appears to be conventional for other toolkits (although
277274 # Gtk+ and Qt do not appear to use as large a factor).
275 #
276
277 ## ttk::bindMouseWheel $bindtag $command...
278 # Adds basic mousewheel support to $bindtag.
279 # $command will be passed one additional argument
280 # specifying the mousewheel direction (-1: up, +1: down).
281 #
282
283 proc ttk::bindMouseWheel {bindtag callback} {
284 switch -- [tk windowingsystem] {
285 x11 {
286 bind $bindtag <ButtonPress-4> "$callback -1"
287 bind $bindtag <ButtonPress-5> "$callback +1"
288 }
289 win32 {
290 bind $bindtag <MouseWheel> [append callback { [expr {-(%D/120)}]}]
291 }
292 aqua {
293 bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ]
294 }
295 }
296 }
297
298 ## Mousewheel bindings for standard scrollable widgets.
299 #
300 # Usage: [ttk::copyBindings TtkScrollable $bindtag]
301 #
302 # $bindtag should be for a widget that supports the
303 # standard scrollbar protocol.
278304 #
279305
280306 switch -- [tk windowingsystem] {
0 #
1 # Settings for Microsoft Windows Vista and Server 2008
2 #
3
4 # The Vista theme can only be defined on Windows Vista and above. The theme
5 # is created in C due to the need to assign a theme-enabled function for
6 # detecting when themeing is disabled. On systems that cannot support the
7 # Vista theme, there will be no such theme created and we must not
8 # evaluate this script.
9
10 if {"vista" ni [ttk::style theme names]} {
11 return
12 }
13
14 namespace eval ttk::theme::vista {
15
16 ttk::style theme settings vista {
17
18 ttk::style configure . \
19 -background SystemButtonFace \
20 -foreground SystemWindowText \
21 -selectforeground SystemHighlightText \
22 -selectbackground SystemHighlight \
23 -font TkDefaultFont \
24 ;
25
26 ttk::style map "." \
27 -foreground [list disabled SystemGrayText] \
28 ;
29
30 ttk::style configure TButton -anchor center -padding {1 1} -width -11
31 ttk::style configure TRadiobutton -padding 2
32 ttk::style configure TCheckbutton -padding 2
33 ttk::style configure TMenubutton -padding {8 4}
34
35 ttk::style configure TNotebook -tabmargins {2 2 2 0}
36 ttk::style map TNotebook.Tab \
37 -expand [list selected {2 2 2 2}]
38
39 # Treeview:
40 ttk::style configure Heading -font TkHeadingFont
41 ttk::style configure Treeview -background SystemWindow
42 ttk::style map Treeview \
43 -background [list selected SystemHighlight] \
44 -foreground [list selected SystemHighlightText] ;
45
46 # Label and Toolbutton
47 ttk::style configure TLabelframe.Label -foreground "#0046d5"
48
49 ttk::style configure Toolbutton -padding {4 4}
50
51 # Combobox
52 ttk::style configure TCombobox -padding 2
53 ttk::style element create Combobox.field vsapi \
54 COMBOBOX 2 {{} 1}
55 ttk::style element create Combobox.border vsapi \
56 COMBOBOX 4 {disabled 4 focus 3 active 2 hover 2 {} 1}
57 ttk::style element create Combobox.rightdownarrow vsapi \
58 COMBOBOX 6 {disabled 4 pressed 3 active 2 {} 1}
59 ttk::style layout TCombobox {
60 Combobox.border -sticky nswe -border 0 -children {
61 Combobox.rightdownarrow -side right -sticky ns
62 Combobox.padding -expand 1 -sticky nswe -children {
63 Combobox.focus -expand 1 -sticky nswe -children {
64 Combobox.textarea -sticky nswe
65 }
66 }
67 }
68 }
69 # Vista.Combobox droplist frame
70 ttk::style element create ComboboxPopdownFrame.background vsapi\
71 LISTBOX 3 {disabled 4 active 3 focus 2 {} 1}
72 ttk::style layout ComboboxPopdownFrame {
73 ComboboxPopdownFrame.background -sticky news -border 1 -children {
74 ComboboxPopdownFrame.padding -sticky news
75 }
76 }
77 ttk::style map TCombobox \
78 -selectbackground [list !focus SystemWindow] \
79 -selectforeground [list !focus SystemWindowText] \
80 -foreground [list {readonly focus} SystemHighlightText] \
81 -focusfill [list {readonly focus} SystemHighlight] \
82 ;
83
84 # Entry
85 ttk::style configure TEntry -padding {1 1 1 1} ;# Needs lookup
86 ttk::style element create Entry.field vsapi \
87 EDIT 6 {disabled 4 focus 3 hover 2 {} 1} -padding {2 2 2 2}
88 ttk::style element create Entry.background vsapi \
89 EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}
90 ttk::style layout TEntry {
91 Entry.field -sticky news -border 0 -children {
92 Entry.background -sticky news -children {
93 Entry.padding -sticky news -children {
94 Entry.textarea -sticky news
95 }
96 }
97 }
98 }
99 ttk::style map TEntry \
100 -selectbackground [list !focus SystemWindow] \
101 -selectforeground [list !focus SystemWindowText] \
102 ;
103
104 # Spinbox
105 ttk::style configure TSpinbox -padding 0 ;#{2 0 15 1}
106 ttk::style element create Spinbox.field vsapi \
107 EDIT 9 {disabled 4 focus 3 hover 2 {} 1} -padding {1 1 1 2}
108 ttk::style element create Spinbox.background vsapi \
109 EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}
110 ttk::style element create Spinbox.innerbg vsapi \
111 EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1}\
112 -padding {2 0 15 1}
113 ttk::style element create Spinbox.uparrow vsapi \
114 SPIN 1 {disabled 4 pressed 3 active 2 {} 1} \
115 -height 5 -width 8
116 ttk::style element create Spinbox.downarrow vsapi \
117 SPIN 2 {disabled 4 pressed 3 active 2 {} 1} \
118 -height 5 -width 8
119 ttk::style layout TSpinbox {
120 Spinbox.field -sticky nswe -children {
121 Spinbox.background -sticky news -children {
122 Spinbox.padding -sticky news -children {
123 Spinbox.innerbg -sticky news -children {
124 Spinbox.textarea -expand 1 -sticky {}
125 }
126 }
127 Spinbox.uparrow -side top -sticky ens
128 Spinbox.downarrow -side bottom -sticky ens
129 }
130 }
131 }
132 ttk::style map TSpinbox \
133 -selectbackground [list !focus SystemWindow] \
134 -selectforeground [list !focus SystemWindowText] \
135 ;
136
137
138 # SCROLLBAR elements (Vista includes a state for 'hover')
139 ttk::style element create Vertical.Scrollbar.uparrow vsapi \
140 SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1}
141 ttk::style element create Vertical.Scrollbar.downarrow vsapi \
142 SCROLLBAR 1 {disabled 8 pressed 7 active 6 hover 18 {} 5}
143 ttk::style element create Vertical.Scrollbar.trough vsapi \
144 SCROLLBAR 7 {disabled 4 pressed 3 active 2 hover 5 {} 1}
145 ttk::style element create Vertical.Scrollbar.thumb vsapi \
146 SCROLLBAR 3 {disabled 4 pressed 3 active 2 hover 5 {} 1}
147 ttk::style element create Vertical.Scrollbar.grip vsapi \
148 SCROLLBAR 9 {disabled 4 pressed 3 active 2 hover 5 {} 1}
149 ttk::style element create Horizontal.Scrollbar.leftarrow vsapi \
150 SCROLLBAR 1 {disabled 12 pressed 11 active 10 hover 19 {} 9}
151 ttk::style element create Horizontal.Scrollbar.rightarrow vsapi \
152 SCROLLBAR 1 {disabled 16 pressed 15 active 14 hover 20 {} 13}
153 ttk::style element create Horizontal.Scrollbar.trough vsapi \
154 SCROLLBAR 5 {disabled 4 pressed 3 active 2 hover 5 {} 1}
155 ttk::style element create Horizontal.Scrollbar.thumb vsapi \
156 SCROLLBAR 2 {disabled 4 pressed 3 active 2 hover 5 {} 1}
157 ttk::style element create Horizontal.Scrollbar.grip vsapi \
158 SCROLLBAR 8 {disabled 4 pressed 3 active 2 hover 5 {} 1}
159
160 # Progressbar
161 ttk::style element create Horizontal.Progressbar.pbar vsapi \
162 PROGRESS 3 {{} 1} -padding 8
163 ttk::style layout Horizontal.TProgressbar {
164 Horizontal.Progressbar.trough -sticky nswe -children {
165 Horizontal.Progressbar.pbar -side left -sticky ns
166 }
167 }
168 ttk::style element create Vertical.Progressbar.pbar vsapi \
169 PROGRESS 3 {{} 1} -padding 8
170 ttk::style layout Vertical.TProgressbar {
171 Vertical.Progressbar.trough -sticky nswe -children {
172 Vertical.Progressbar.pbar -side bottom -sticky we
173 }
174 }
175
176 # Scale
177 ttk::style element create Horizontal.Scale.slider vsapi \
178 TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
179 -width 6 -height 12
180 ttk::style layout Horizontal.TScale {
181 Scale.focus -expand 1 -sticky nswe -children {
182 Horizontal.Scale.trough -expand 1 -sticky nswe -children {
183 Horizontal.Scale.track -sticky we
184 Horizontal.Scale.slider -side left -sticky {}
185 }
186 }
187 }
188 ttk::style element create Vertical.Scale.slider vsapi \
189 TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
190 -width 12 -height 6
191 ttk::style layout Vertical.TScale {
192 Scale.focus -expand 1 -sticky nswe -children {
193 Vertical.Scale.trough -expand 1 -sticky nswe -children {
194 Vertical.Scale.track -sticky ns
195 Vertical.Scale.slider -side top -sticky {}
196 }
197 }
198 }
199
200
201 package provide ttk::theme::vista 1.0
202 }
203 }
00 #
1 # $Id: winTheme.tcl,v 1.7 2008/05/23 20:20:06 jenglish Exp $
1 # $Id: winTheme.tcl,v 1.9 2008/11/29 00:43:48 patthoyts Exp $
22 #
33 # Settings for 'winnative' theme.
44 #
4444 -focusfill [list {readonly focus} SystemHighlight] \
4545 ;
4646
47 ttk::style element create ComboboxPopdownFrame.border from default
48 ttk::style configure ComboboxPopdownFrame \
49 -borderwidth 1 -relief solid
50
51 ttk::style configure TSpinbox -padding {2 0 16 0}
52
4753 ttk::style configure TLabelframe -borderwidth 2 -relief groove
4854
4955 ttk::style configure Toolbutton -relief flat -padding {8 4}
00 #
1 # $Id: xpTheme.tcl,v 1.9 2008/05/23 20:20:06 jenglish Exp $
1 # $Id: xpTheme.tcl,v 1.12 2008/12/05 11:11:58 patthoyts Exp $
22 #
33 # Settings for 'xpnative' theme
44 #
5151 -focusfill [list {readonly focus} SystemHighlight] \
5252 ;
5353
54 ttk::style configure TSpinbox -padding {2 0 14 0}
55 ttk::style map TSpinbox \
56 -selectbackground [list !focus SystemWindow] \
57 -selectforeground [list !focus SystemWindowText] \
58 ;
59
5460 ttk::style configure Toolbutton -padding {4 4}
5561
56 # Vista requires some style modifications. There are some
57 # additional or different elements in use.
58 if {[tk windowingsystem] eq "win32"
59 && [info exists tcl_platform(osVersion)]
60 && $tcl_platform(osVersion) >= 6.0} {
61
62 ttk::style element create Combobox.field vsapi \
63 COMBOBOX 2 {{} 1}
64 ttk::style element create Combobox.border vsapi \
65 COMBOBOX 4 {disabled 4 focus 3 active 2 {} 1}
66 ttk::style layout TCombobox {
67 Combobox.border -sticky nswe -border 0 -children {
68 Combobox.downarrow -side right -sticky ns
69 Combobox.padding -expand 1 -sticky nswe -children {
70 Combobox.focus -expand 1 -sticky nswe -children {
71 Combobox.textarea -sticky nswe
72 }
73 }
74 }
75 }
76
77 }
7862 }
7963 }
88 # See the file "license.terms" for information on usage and redistribution of
99 # this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 #
11 # RCS: @(#) $Id: GNUmakefile,v 1.11 2008/08/19 00:08:34 das Exp $
11 # RCS: @(#) $Id: GNUmakefile,v 1.12 2008/10/23 12:20:16 das Exp $
1212 #
1313 ########################################################################################################
1414
130130 override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-xft
131131 VERSION := ${VERSION}-X11
132132 wish := ${wish}-X11
133 override EMBEDDED_BUILD := 0
133 override EMBEDDED_BUILD :=
134134 endif
135135
136136 INSTALL_TARGETS = install-binaries install-libraries
88 // See the file "license.terms" for information on usage and redistribution
99 // of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 //
11 // RCS: @(#) $Id: Wish-Common.xcconfig,v 1.11 2008/04/01 16:30:54 dgp Exp $
11 // RCS: @(#) $Id: Wish-Common.xcconfig,v 1.12 2008/11/14 13:01:39 das Exp $
1212 //
1313
1414 HEADER_SEARCH_PATHS = $(TK_SRCROOT)/generic $(TK_SRCROOT)/xlib "$(DERIVED_FILE_DIR)/tcl" "$(DERIVED_FILE_DIR)/tk" $(HEADER_SEARCH_PATHS)
2626 GCC_VERSION = 4.0
2727 CC = $(GCC)-$(GCC_VERSION)
2828 LD = $(CC)
29 WARNING_CFLAGS_GCC3 = -Wall -Wno-implicit-int -Wno-unused-parameter -Wno-deprecated-declarations
29 WARNING_CFLAGS_GCC3 = -Wall -Wno-unused-parameter -Wno-deprecated-declarations
3030 WARNING_CFLAGS = -Wextra -Wno-missing-field-initializers -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS_GCC3) $(WARNING_CFLAGS)
3131 REZ_RESOURCE_MAP_READ_ONLY = YES
3232 APPLICATION_INSTALL_PATH = /Applications/Utilities
77
88 /* Begin PBXBuildFile section */
99 F9067BCD0BFBA2900074F726 /* tkOldTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFE08F27A39005CB29B /* tkOldTest.c */; };
10 F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; };
11 F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; };
12 F92EE8BF0E62F846001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; };
13 F92EE8D30E62F939001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; };
1014 F93599B30DF1F75400E04F67 /* tclOO.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B20DF1F75400E04F67 /* tclOO.c */; };
1115 F93599B70DF1F76100E04F67 /* tclOOBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B60DF1F76100E04F67 /* tclOOBasic.c */; };
1216 F93599B90DF1F76600E04F67 /* tclOOCall.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B80DF1F76600E04F67 /* tclOOCall.c */; };
1620 F93599C40DF1F78800E04F67 /* tclOOStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C30DF1F78800E04F67 /* tclOOStubInit.c */; };
1721 F93599C60DF1F78D00E04F67 /* tclOOStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */; };
1822 F95D77EA0DFD820D00A8BF6F /* tclIORTrans.c in Sources */ = {isa = PBXBuildFile; fileRef = F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */; };
23 F96437CA0EF0D4B2003F468E /* tclZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96437C90EF0D4B2003F468E /* tclZlib.c */; };
24 F96437CB0EF0D4B2003F468E /* tclZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96437C90EF0D4B2003F468E /* tclZlib.c */; };
25 F96437E70EF0D652003F468E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F96437E60EF0D652003F468E /* libz.dylib */; };
26 F96437E80EF0D652003F468E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F96437E60EF0D652003F468E /* libz.dylib */; };
1927 F966BDCF08F27A3F005CB29B /* tk3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAC08F27A39005CB29B /* tk3d.c */; };
2028 F966BDD108F27A3F005CB29B /* tkArgv.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAE08F27A39005CB29B /* tkArgv.c */; };
2129 F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAF08F27A39005CB29B /* tkAtom.c */; };
614622 8DD76FB20486AB0100D96B5E /* tktest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tktest; sourceTree = BUILT_PRODUCTS_DIR; };
615623 F9099B8A0CC67D30005A9580 /* textpeer.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textpeer.tcl; sourceTree = "<group>"; };
616624 F9099B8B0CC67D3E005A9580 /* ttkbut.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkbut.tcl; sourceTree = "<group>"; };
625 F9152B080EAF8A5000CD5C7B /* tkBusy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkBusy.c; sourceTree = "<group>"; };
626 F91543270EF201A90032D1E8 /* fontchoose.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchoose.tcl; sourceTree = "<group>"; };
627 F915432A0EF201CF0032D1E8 /* zlib.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = zlib.test; sourceTree = "<group>"; };
628 F915432D0EF201EE0032D1E8 /* zlib.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = zlib.n; sourceTree = "<group>"; };
629 F9183E640EFC80CD0030B814 /* throw.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = throw.n; sourceTree = "<group>"; };
630 F9183E650EFC80D70030B814 /* try.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = try.n; sourceTree = "<group>"; };
631 F9183E6A0EFC81560030B814 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
632 F9183E8F0EFC817B0030B814 /* tdbc */ = {isa = PBXFileReference; lastKnownFileType = folder; path = tdbc; sourceTree = "<group>"; };
633 F91DC23C0E44C51B002CB8D1 /* nre.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = nre.test; sourceTree = "<group>"; };
634 F91DC23D0E44C530002CB8D1 /* unsupported.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = unsupported.test; sourceTree = "<group>"; };
617635 F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Tclsh-Info.plist.in"; sourceTree = "<group>"; };
618636 F92240290D7C620F005EC715 /* knightstour.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = knightstour.tcl; sourceTree = "<group>"; };
619637 F92D7F100DE777240033A13A /* tsdPerf.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tsdPerf.tcl; sourceTree = "<group>"; };
620638 F92D7F140DE777670033A13A /* tsdPerf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tsdPerf.c; sourceTree = "<group>"; };
639 F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgPhInstance.c; sourceTree = "<group>"; };
621640 F93599B20DF1F75400E04F67 /* tclOO.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOO.c; sourceTree = "<group>"; };
622641 F93599B40DF1F75900E04F67 /* tclOO.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclOO.decls; sourceTree = "<group>"; };
623642 F93599B50DF1F75D00E04F67 /* tclOO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOO.h; sourceTree = "<group>"; };
650669 F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIORTrans.c; sourceTree = "<group>"; };
651670 F95FAFF90B34F1130072E431 /* macOSXLoad.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = macOSXLoad.test; sourceTree = "<group>"; };
652671 F962F7C60DADC26200648DB8 /* vsapi.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vsapi.test; sourceTree = "<group>"; };
672 F96437C90EF0D4B2003F468E /* tclZlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclZlib.c; sourceTree = "<group>"; };
673 F96437E60EF0D652003F468E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
653674 F966BA0408F27A37005CB29B /* error.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = error.xbm; sourceTree = "<group>"; };
654675 F966BA0508F27A37005CB29B /* gray12.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray12.xbm; sourceTree = "<group>"; };
655676 F966BA0608F27A37005CB29B /* gray25.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray25.xbm; sourceTree = "<group>"; };
9881009 F966BB8708F27A3A005CB29B /* optMenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optMenu.tcl; sourceTree = "<group>"; };
9891010 F966BB8808F27A3A005CB29B /* palette.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = palette.tcl; sourceTree = "<group>"; };
9901011 F966BB8908F27A3B005CB29B /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
991 F966BB8A08F27A3B005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
9921012 F966BB8B08F27A3B005CB29B /* safetk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safetk.tcl; sourceTree = "<group>"; };
9931013 F966BB8C08F27A3B005CB29B /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; };
9941014 F966BB8D08F27A3B005CB29B /* scrlbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrlbar.tcl; sourceTree = "<group>"; };
10961116 F966BC2F08F27A3C005CB29B /* get.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = get.test; sourceTree = "<group>"; };
10971117 F966BC3008F27A3C005CB29B /* grab.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grab.test; sourceTree = "<group>"; };
10981118 F966BC3108F27A3C005CB29B /* grid.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grid.test; sourceTree = "<group>"; };
1099 F966BC3208F27A3C005CB29B /* id.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = id.test; sourceTree = "<group>"; };
11001119 F966BC3308F27A3C005CB29B /* image.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image.test; sourceTree = "<group>"; };
11011120 F966BC3408F27A3C005CB29B /* imgBmap.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgBmap.test; sourceTree = "<group>"; };
11021121 F966BC3508F27A3C005CB29B /* imgPhoto.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgPhoto.test; sourceTree = "<group>"; };
20712090 F96D449808F272BA004A47F5 /* tclWinThrd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinThrd.c; sourceTree = "<group>"; };
20722091 F96D449908F272BA004A47F5 /* tclWinThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinThrd.h; sourceTree = "<group>"; };
20732092 F96D449A08F272BA004A47F5 /* tclWinTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinTime.c; sourceTree = "<group>"; };
2093 F973E5960EE99384001A648E /* vistaTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vistaTheme.tcl; sourceTree = "<group>"; };
20742094 F976F6A70C325FB6005066D9 /* tkMacOSXPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXPrivate.h; sourceTree = "<group>"; };
20752095 F97AE7F10B65C1E900310EA2 /* Wish-Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Common.xcconfig"; sourceTree = "<group>"; };
20762096 F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Release.xcconfig"; sourceTree = "<group>"; };
20772097 F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Debug.xcconfig"; sourceTree = "<group>"; };
20782098 F9903CAF094FAADA004613E9 /* tclTomMath.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclTomMath.decls; sourceTree = "<group>"; };
20792099 F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMathDecls.h; sourceTree = "<group>"; };
2100 F99388380EE0114B0065FE6B /* fontchooser.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchooser.tcl; sourceTree = "<group>"; };
2101 F99388950EE02D980065FE6B /* fontchooser.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchooser.test; sourceTree = "<group>"; };
2102 F99D61180EF5573A00BBFE01 /* TclZlib.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TclZlib.3; sourceTree = "<group>"; };
20802103 F9A3082D08F2D4AB00BAE1AB /* Tk.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
20812104 F9A3084B08F2D4CE00BAE1AB /* Wish.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wish.app; sourceTree = BUILT_PRODUCTS_DIR; };
20822105 F9A3084E08F2D4F400BAE1AB /* Tcl.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tcl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
20832106 F9A493240CEBF38300B78AE2 /* chanio.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = chanio.test; sourceTree = "<group>"; };
2107 F9C888C20EEF6571003F63AD /* fontchooser.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fontchooser.n; sourceTree = "<group>"; };
20842108 F9D1360A0CDC252C00DBE0B5 /* mclist.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mclist.tcl; sourceTree = "<group>"; };
20852109 F9ECB1120B26521500A28025 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
20862110 F9ECB1130B26521500A28025 /* platform.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = platform.tcl; sourceTree = "<group>"; };
21072131 buildActionMask = 2147483647;
21082132 files = (
21092133 F966C07508F2820D005CB29B /* CoreFoundation.framework in Frameworks */,
2134 F96437E70EF0D652003F468E /* libz.dylib in Frameworks */,
21102135 F966C07708F2821B005CB29B /* Carbon.framework in Frameworks */,
21112136 F966C07908F28233005CB29B /* IOKit.framework in Frameworks */,
21122137 );
21172142 buildActionMask = 2147483647;
21182143 files = (
21192144 F9FD31E40CC1AD070073837D /* CoreFoundation.framework in Frameworks */,
2145 F96437E80EF0D652003F468E /* libz.dylib in Frameworks */,
21202146 F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */,
21212147 F9FD32180CC1AF170073837D /* libXext.dylib in Frameworks */,
21222148 F9FD32190CC1AF170073837D /* libXss.dylib in Frameworks */,
21372163 F966C06F08F281DC005CB29B /* Frameworks */,
21382164 1AB674ADFE9D54B511CA2CBB /* Products */,
21392165 );
2140 comments = "Copyright (c) 2004-2008 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.25 2008/06/12 06:31:10 das Exp $\n";
2166 comments = "Copyright (c) 2004-2008 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.26 2008/12/20 02:03:14 das Exp $\n";
21412167 name = Wish;
21422168 path = .;
21432169 sourceTree = SOURCE_ROOT;
21532179 );
21542180 includeInIndex = 0;
21552181 name = Products;
2182 sourceTree = "<group>";
2183 };
2184 F9183E690EFC81560030B814 /* pkgs */ = {
2185 isa = PBXGroup;
2186 children = (
2187 F9183E6A0EFC81560030B814 /* README */,
2188 F9183E8F0EFC817B0030B814 /* tdbc */,
2189 );
2190 path = pkgs;
21562191 sourceTree = "<group>";
21572192 };
21582193 F966BA0308F27A37005CB29B /* bitmaps */ = {
22182253 F966BA3908F27A37005CB29B /* focus.n */,
22192254 F966BA3A08F27A37005CB29B /* focusNext.n */,
22202255 F966BA3B08F27A37005CB29B /* font.n */,
2256 F9C888C20EEF6571003F63AD /* fontchooser.n */,
22212257 F966BA3C08F27A37005CB29B /* FontId.3 */,
22222258 F966BA3D08F27A37005CB29B /* frame.n */,
22232259 F966BA3E08F27A37005CB29B /* FreeXId.3 */,
23632399 F966BAAF08F27A39005CB29B /* tkAtom.c */,
23642400 F966BAB008F27A39005CB29B /* tkBind.c */,
23652401 F966BAB108F27A39005CB29B /* tkBitmap.c */,
2402 F9152B080EAF8A5000CD5C7B /* tkBusy.c */,
23662403 F966BAB208F27A39005CB29B /* tkButton.c */,
23672404 F966BAB308F27A39005CB29B /* tkButton.h */,
23682405 F966BAB408F27A39005CB29B /* tkCanvArc.c */,
24022439 F966BAD708F27A39005CB29B /* tkImage.c */,
24032440 F966BAD808F27A39005CB29B /* tkImgBmap.c */,
24042441 F966BAD908F27A39005CB29B /* tkImgGIF.c */,
2442 F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */,
24052443 F966BADA08F27A39005CB29B /* tkImgPhoto.c */,
24062444 F966BADB08F27A39005CB29B /* tkImgPPM.c */,
24072445 F966BADC08F27A39005CB29B /* tkImgUtil.c */,
24742512 F966BB6208F27A3A005CB29B /* dialog.tcl */,
24752513 F966BB6308F27A3A005CB29B /* entry.tcl */,
24762514 F966BB6408F27A3A005CB29B /* focus.tcl */,
2515 F99388380EE0114B0065FE6B /* fontchooser.tcl */,
24772516 F966BB7308F27A3A005CB29B /* listbox.tcl */,
24782517 F966BB7408F27A3A005CB29B /* menu.tcl */,
24792518 F966BB7508F27A3A005CB29B /* mkpsenc.tcl */,
24822521 F966BB8708F27A3A005CB29B /* optMenu.tcl */,
24832522 F966BB8808F27A3A005CB29B /* palette.tcl */,
24842523 F966BB8908F27A3B005CB29B /* panedwindow.tcl */,
2485 F966BB8A08F27A3B005CB29B /* prolog.ps */,
24862524 F966BB8B08F27A3B005CB29B /* safetk.tcl */,
24872525 F966BB8C08F27A3B005CB29B /* scale.tcl */,
24882526 F966BB8D08F27A3B005CB29B /* scrlbar.tcl */,
25222560 F966BB2C08F27A39005CB29B /* entry3.tcl */,
25232561 F966BB2D08F27A39005CB29B /* filebox.tcl */,
25242562 F966BB2E08F27A39005CB29B /* floor.tcl */,
2563 F91543270EF201A90032D1E8 /* fontchoose.tcl */,
25252564 F966BB2F08F27A39005CB29B /* form.tcl */,
25262565 F966BB3008F27A39005CB29B /* goldberg.tcl */,
25272566 F966BB3108F27A39005CB29B /* hello */,
26792718 F966BC2A08F27A3C005CB29B /* focus.test */,
26802719 F966BC2B08F27A3C005CB29B /* focusTcl.test */,
26812720 F966BC2C08F27A3C005CB29B /* font.test */,
2721 F99388950EE02D980065FE6B /* fontchooser.test */,
26822722 F966BC2D08F27A3C005CB29B /* frame.test */,
26832723 F966BC2E08F27A3C005CB29B /* geometry.test */,
26842724 F966BC2F08F27A3C005CB29B /* get.test */,
26852725 F966BC3008F27A3C005CB29B /* grab.test */,
26862726 F966BC3108F27A3C005CB29B /* grid.test */,
2687 F966BC3208F27A3C005CB29B /* id.test */,
26882727 F966BC3308F27A3C005CB29B /* image.test */,
26892728 F966BC3408F27A3C005CB29B /* imgBmap.test */,
26902729 F966BC3508F27A3C005CB29B /* imgPhoto.test */,
28912930 isa = PBXGroup;
28922931 children = (
28932932 F966C07408F2820D005CB29B /* CoreFoundation.framework */,
2933 F96437E60EF0D652003F468E /* libz.dylib */,
28942934 F966C07608F2821B005CB29B /* Carbon.framework */,
28952935 F966C07808F28233005CB29B /* IOKit.framework */,
28962936 F9FD32140CC1AF170073837D /* libX11.dylib */,
29713011 F968884C0AF787B3000797B5 /* ttk.tcl */,
29723012 F968884D0AF787B3000797B5 /* utils.tcl */,
29733013 F968884E0AF787B3000797B5 /* winTheme.tcl */,
3014 F973E5960EE99384001A648E /* vistaTheme.tcl */,
29743015 F968884F0AF787B3000797B5 /* xpTheme.tcl */,
29753016 );
29763017 path = ttk;
30103051 F96D434408F272B5004A47F5 /* tests */,
30113052 F96D3DFC08F272A4004A47F5 /* doc */,
30123053 F96D43D008F272B8004A47F5 /* tools */,
3054 F9183E690EFC81560030B814 /* pkgs */,
30133055 F96D3DFA08F272A4004A47F5 /* ChangeLog */,
30143056 F96D3DFB08F272A4004A47F5 /* changes */,
30153057 F96D434308F272B5004A47F5 /* README */,
32293271 F96D3EAB08F272A7004A47F5 /* SubstObj.3 */,
32303272 F96D3EAC08F272A7004A47F5 /* switch.n */,
32313273 F96D3EAD08F272A7004A47F5 /* Tcl.n */,
3274 F99D61180EF5573A00BBFE01 /* TclZlib.3 */,
32323275 F96D3EAE08F272A7004A47F5 /* Tcl_Main.3 */,
32333276 F96D3EAF08F272A7004A47F5 /* TCL_MEM_DEBUG.3 */,
32343277 F96D3EB008F272A7004A47F5 /* tclsh.1 */,
32363279 F96D3EB208F272A7004A47F5 /* tclvars.n */,
32373280 F96D3EB308F272A7004A47F5 /* tell.n */,
32383281 F96D3EB408F272A7004A47F5 /* Thread.3 */,
3282 F9183E640EFC80CD0030B814 /* throw.n */,
32393283 F96D3EB508F272A7004A47F5 /* time.n */,
32403284 F96D3EB608F272A7004A47F5 /* tm.n */,
32413285 F96D3EB708F272A7004A47F5 /* ToUpper.3 */,
32433287 F96D3EB908F272A7004A47F5 /* TraceCmd.3 */,
32443288 F96D3EBA08F272A7004A47F5 /* TraceVar.3 */,
32453289 F96D3EBB08F272A7004A47F5 /* Translate.3 */,
3290 F9183E650EFC80D70030B814 /* try.n */,
32463291 F96D3EBC08F272A7004A47F5 /* UniCharIsAlpha.3 */,
32473292 F96D3EBD08F272A7004A47F5 /* unknown.n */,
32483293 F96D3EBE08F272A7004A47F5 /* unload.n */,
32563301 F96D3EC608F272A7004A47F5 /* vwait.n */,
32573302 F96D3EC708F272A7004A47F5 /* while.n */,
32583303 F96D3EC808F272A7004A47F5 /* WrongNumArgs.3 */,
3304 F915432D0EF201EE0032D1E8 /* zlib.n */,
32593305 );
32603306 path = doc;
32613307 sourceTree = "<group>";
33833429 F96D3F3408F272A7004A47F5 /* tclUtf.c */,
33843430 F96D3F3508F272A7004A47F5 /* tclUtil.c */,
33853431 F96D3F3608F272A7004A47F5 /* tclVar.c */,
3432 F96437C90EF0D4B2003F468E /* tclZlib.c */,
33863433 F96D3F3708F272A7004A47F5 /* tommath.h */,
33873434 );
33883435 path = generic;
37063753 F96D439108F272B6004A47F5 /* namespace-old.test */,
37073754 F96D439208F272B7004A47F5 /* namespace.test */,
37083755 F96D439308F272B7004A47F5 /* notify.test */,
3756 F91DC23C0E44C51B002CB8D1 /* nre.test */,
37093757 F96D439408F272B7004A47F5 /* obj.test */,
37103758 F93599C80DF1F81900E04F67 /* oo.test */,
37113759 F96D439508F272B7004A47F5 /* opt.test */,
37533801 F96D43BF08F272B7004A47F5 /* unixNotfy.test */,
37543802 F96D43C008F272B7004A47F5 /* unknown.test */,
37553803 F96D43C108F272B7004A47F5 /* unload.test */,
3804 F91DC23D0E44C530002CB8D1 /* unsupported.test */,
37563805 F96D43C208F272B7004A47F5 /* uplevel.test */,
37573806 F96D43C308F272B7004A47F5 /* upvar.test */,
37583807 F96D43C408F272B7004A47F5 /* utf.test */,
37673816 F96D43CD08F272B7004A47F5 /* winNotify.test */,
37683817 F96D43CE08F272B7004A47F5 /* winPipe.test */,
37693818 F96D43CF08F272B7004A47F5 /* winTime.test */,
3819 F915432A0EF201CF0032D1E8 /* zlib.test */,
37703820 );
37713821 path = tests;
37723822 sourceTree = "<group>";
42124262 F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */,
42134263 F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */,
42144264 F96D45D508F272BC004A47F5 /* tclVar.c in Sources */,
4265 F96437CA0EF0D4B2003F468E /* tclZlib.c in Sources */,
42154266 F96D48E208F272C3004A47F5 /* bn_fast_s_mp_mul_digs.c in Sources */,
42164267 F96D48E408F272C3004A47F5 /* bn_fast_s_mp_sqr.c in Sources */,
42174268 F96D48E708F272C3004A47F5 /* bn_mp_add.c in Sources */,
42934344 F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */,
42944345 F966BDD308F27A3F005CB29B /* tkBind.c in Sources */,
42954346 F966BDD408F27A3F005CB29B /* tkBitmap.c in Sources */,
4347 F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */,
42964348 F966BDD508F27A3F005CB29B /* tkButton.c in Sources */,
42974349 F966BDD708F27A3F005CB29B /* tkCanvArc.c in Sources */,
42984350 F966BDD808F27A3F005CB29B /* tkCanvas.c in Sources */,
43254377 F966BDFA08F27A3F005CB29B /* tkImage.c in Sources */,
43264378 F966BDFB08F27A3F005CB29B /* tkImgBmap.c in Sources */,
43274379 F966BDFC08F27A3F005CB29B /* tkImgGIF.c in Sources */,
4380 F92EE8BF0E62F846001A6E80 /* tkImgPhInstance.c in Sources */,
43284381 F966BDFD08F27A3F005CB29B /* tkImgPhoto.c in Sources */,
43294382 F966BDFE08F27A3F005CB29B /* tkImgPPM.c in Sources */,
43304383 F966BE0708F27A3F005CB29B /* tkListbox.c in Sources */,
45224575 F9FD31000CC1AD070073837D /* tclUtf.c in Sources */,
45234576 F9FD31010CC1AD070073837D /* tclUtil.c in Sources */,
45244577 F9FD31020CC1AD070073837D /* tclVar.c in Sources */,
4578 F96437CB0EF0D4B2003F468E /* tclZlib.c in Sources */,
45254579 F9FD31030CC1AD070073837D /* bn_fast_s_mp_mul_digs.c in Sources */,
45264580 F9FD31040CC1AD070073837D /* bn_fast_s_mp_sqr.c in Sources */,
45274581 F9FD31050CC1AD070073837D /* bn_mp_add.c in Sources */,
46034657 F9FD31510CC1AD070073837D /* tkAtom.c in Sources */,
46044658 F9FD31520CC1AD070073837D /* tkBind.c in Sources */,
46054659 F9FD31530CC1AD070073837D /* tkBitmap.c in Sources */,
4660 F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */,
46064661 F9FD31540CC1AD070073837D /* tkButton.c in Sources */,
46074662 F9FD31550CC1AD070073837D /* tkCanvArc.c in Sources */,
46084663 F9FD31560CC1AD070073837D /* tkCanvas.c in Sources */,
46354690 F9FD31710CC1AD070073837D /* tkImage.c in Sources */,
46364691 F9FD31720CC1AD070073837D /* tkImgBmap.c in Sources */,
46374692 F9FD31730CC1AD070073837D /* tkImgGIF.c in Sources */,
4693 F92EE8D30E62F939001A6E80 /* tkImgPhInstance.c in Sources */,
46384694 F9FD31740CC1AD070073837D /* tkImgPhoto.c in Sources */,
46394695 F9FD31750CC1AD070073837D /* tkImgPPM.c in Sources */,
46404696 F9FD31760CC1AD070073837D /* tkListbox.c in Sources */,
77
88 /* Begin PBXBuildFile section */
99 F9067BCD0BFBA2900074F726 /* tkOldTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFE08F27A39005CB29B /* tkOldTest.c */; };
10 F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; };
11 F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; };
1012 F92EE8BF0E62F846001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; };
1113 F92EE8D30E62F939001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; };
1214 F93599B30DF1F75400E04F67 /* tclOO.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B20DF1F75400E04F67 /* tclOO.c */; };
1820 F93599C40DF1F78800E04F67 /* tclOOStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C30DF1F78800E04F67 /* tclOOStubInit.c */; };
1921 F93599C60DF1F78D00E04F67 /* tclOOStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */; };
2022 F95D77EA0DFD820D00A8BF6F /* tclIORTrans.c in Sources */ = {isa = PBXBuildFile; fileRef = F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */; };
23 F96437CA0EF0D4B2003F468E /* tclZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96437C90EF0D4B2003F468E /* tclZlib.c */; };
24 F96437CB0EF0D4B2003F468E /* tclZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96437C90EF0D4B2003F468E /* tclZlib.c */; };
25 F96437E70EF0D652003F468E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F96437E60EF0D652003F468E /* libz.dylib */; };
26 F96437E80EF0D652003F468E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F96437E60EF0D652003F468E /* libz.dylib */; };
2127 F966BDCF08F27A3F005CB29B /* tk3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAC08F27A39005CB29B /* tk3d.c */; };
2228 F966BDD108F27A3F005CB29B /* tkArgv.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAE08F27A39005CB29B /* tkArgv.c */; };
2329 F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAF08F27A39005CB29B /* tkAtom.c */; };
618624 8DD76FB20486AB0100D96B5E /* tktest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tktest; sourceTree = BUILT_PRODUCTS_DIR; };
619625 F9099B8A0CC67D30005A9580 /* textpeer.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textpeer.tcl; sourceTree = "<group>"; };
620626 F9099B8B0CC67D3E005A9580 /* ttkbut.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkbut.tcl; sourceTree = "<group>"; };
627 F9152B080EAF8A5000CD5C7B /* tkBusy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkBusy.c; sourceTree = "<group>"; };
628 F91543270EF201A90032D1E8 /* fontchoose.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchoose.tcl; sourceTree = "<group>"; };
629 F915432A0EF201CF0032D1E8 /* zlib.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = zlib.test; sourceTree = "<group>"; };
630 F915432D0EF201EE0032D1E8 /* zlib.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = zlib.n; sourceTree = "<group>"; };
631 F9183E640EFC80CD0030B814 /* throw.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = throw.n; sourceTree = "<group>"; };
632 F9183E650EFC80D70030B814 /* try.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = try.n; sourceTree = "<group>"; };
633 F9183E6A0EFC81560030B814 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
634 F9183E8F0EFC817B0030B814 /* tdbc */ = {isa = PBXFileReference; lastKnownFileType = folder; path = tdbc; sourceTree = "<group>"; };
621635 F91DC23C0E44C51B002CB8D1 /* nre.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = nre.test; sourceTree = "<group>"; };
622636 F91DC23D0E44C530002CB8D1 /* unsupported.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = unsupported.test; sourceTree = "<group>"; };
623637 F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Tclsh-Info.plist.in"; sourceTree = "<group>"; };
657671 F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIORTrans.c; sourceTree = "<group>"; };
658672 F95FAFF90B34F1130072E431 /* macOSXLoad.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = macOSXLoad.test; sourceTree = "<group>"; };
659673 F962F7C60DADC26200648DB8 /* vsapi.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vsapi.test; sourceTree = "<group>"; };
674 F96437C90EF0D4B2003F468E /* tclZlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclZlib.c; sourceTree = "<group>"; };
675 F96437E60EF0D652003F468E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
660676 F966BA0408F27A37005CB29B /* error.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = error.xbm; sourceTree = "<group>"; };
661677 F966BA0508F27A37005CB29B /* gray12.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray12.xbm; sourceTree = "<group>"; };
662678 F966BA0608F27A37005CB29B /* gray25.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray25.xbm; sourceTree = "<group>"; };
9951011 F966BB8708F27A3A005CB29B /* optMenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optMenu.tcl; sourceTree = "<group>"; };
9961012 F966BB8808F27A3A005CB29B /* palette.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = palette.tcl; sourceTree = "<group>"; };
9971013 F966BB8908F27A3B005CB29B /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
998 F966BB8A08F27A3B005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
9991014 F966BB8B08F27A3B005CB29B /* safetk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safetk.tcl; sourceTree = "<group>"; };
10001015 F966BB8C08F27A3B005CB29B /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; };
10011016 F966BB8D08F27A3B005CB29B /* scrlbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrlbar.tcl; sourceTree = "<group>"; };
20772092 F96D449808F272BA004A47F5 /* tclWinThrd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinThrd.c; sourceTree = "<group>"; };
20782093 F96D449908F272BA004A47F5 /* tclWinThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinThrd.h; sourceTree = "<group>"; };
20792094 F96D449A08F272BA004A47F5 /* tclWinTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinTime.c; sourceTree = "<group>"; };
2095 F973E5960EE99384001A648E /* vistaTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vistaTheme.tcl; sourceTree = "<group>"; };
20802096 F976F6A70C325FB6005066D9 /* tkMacOSXPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXPrivate.h; sourceTree = "<group>"; };
20812097 F97AE7F10B65C1E900310EA2 /* Wish-Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Common.xcconfig"; sourceTree = "<group>"; };
20822098 F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Release.xcconfig"; sourceTree = "<group>"; };
20832099 F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Debug.xcconfig"; sourceTree = "<group>"; };
20842100 F9903CAF094FAADA004613E9 /* tclTomMath.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclTomMath.decls; sourceTree = "<group>"; };
20852101 F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMathDecls.h; sourceTree = "<group>"; };
2102 F99388380EE0114B0065FE6B /* fontchooser.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchooser.tcl; sourceTree = "<group>"; };
2103 F99388950EE02D980065FE6B /* fontchooser.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchooser.test; sourceTree = "<group>"; };
2104 F99D61180EF5573A00BBFE01 /* TclZlib.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TclZlib.3; sourceTree = "<group>"; };
20862105 F9A3082D08F2D4AB00BAE1AB /* Tk.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
20872106 F9A3084B08F2D4CE00BAE1AB /* Wish.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wish.app; sourceTree = BUILT_PRODUCTS_DIR; };
20882107 F9A3084E08F2D4F400BAE1AB /* Tcl.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tcl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
20892108 F9A493240CEBF38300B78AE2 /* chanio.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = chanio.test; sourceTree = "<group>"; };
2109 F9C888C20EEF6571003F63AD /* fontchooser.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fontchooser.n; sourceTree = "<group>"; };
20902110 F9D1360A0CDC252C00DBE0B5 /* mclist.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mclist.tcl; sourceTree = "<group>"; };
20912111 F9ECB1120B26521500A28025 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
20922112 F9ECB1130B26521500A28025 /* platform.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = platform.tcl; sourceTree = "<group>"; };
21142134 buildActionMask = 2147483647;
21152135 files = (
21162136 F966C07508F2820D005CB29B /* CoreFoundation.framework in Frameworks */,
2137 F96437E70EF0D652003F468E /* libz.dylib in Frameworks */,
21172138 F966C07708F2821B005CB29B /* Carbon.framework in Frameworks */,
21182139 F966C07908F28233005CB29B /* IOKit.framework in Frameworks */,
21192140 );
21242145 buildActionMask = 2147483647;
21252146 files = (
21262147 F9FD31E40CC1AD070073837D /* CoreFoundation.framework in Frameworks */,
2148 F96437E80EF0D652003F468E /* libz.dylib in Frameworks */,
21272149 F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */,
21282150 F9FD32180CC1AF170073837D /* libXext.dylib in Frameworks */,
21292151 F9FD32190CC1AF170073837D /* libXss.dylib in Frameworks */,
21442166 F966C06F08F281DC005CB29B /* Frameworks */,
21452167 1AB674ADFE9D54B511CA2CBB /* Products */,
21462168 );
2147 comments = "Copyright (c) 2004-2008 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.46 2008/08/25 14:33:50 das Exp $\n";
2169 comments = "Copyright (c) 2004-2008 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.52 2008/12/20 01:57:22 das Exp $\n";
21482170 name = Wish;
21492171 path = .;
21502172 sourceTree = SOURCE_ROOT;
21602182 );
21612183 includeInIndex = 0;
21622184 name = Products;
2185 sourceTree = "<group>";
2186 };
2187 F9183E690EFC81560030B814 /* pkgs */ = {
2188 isa = PBXGroup;
2189 children = (
2190 F9183E6A0EFC81560030B814 /* README */,
2191 F9183E8F0EFC817B0030B814 /* tdbc */,
2192 );
2193 path = pkgs;
21632194 sourceTree = "<group>";
21642195 };
21652196 F966BA0308F27A37005CB29B /* bitmaps */ = {
22252256 F966BA3908F27A37005CB29B /* focus.n */,
22262257 F966BA3A08F27A37005CB29B /* focusNext.n */,
22272258 F966BA3B08F27A37005CB29B /* font.n */,
2259 F9C888C20EEF6571003F63AD /* fontchooser.n */,
22282260 F966BA3C08F27A37005CB29B /* FontId.3 */,
22292261 F966BA3D08F27A37005CB29B /* frame.n */,
22302262 F966BA3E08F27A37005CB29B /* FreeXId.3 */,
23702402 F966BAAF08F27A39005CB29B /* tkAtom.c */,
23712403 F966BAB008F27A39005CB29B /* tkBind.c */,
23722404 F966BAB108F27A39005CB29B /* tkBitmap.c */,
2405 F9152B080EAF8A5000CD5C7B /* tkBusy.c */,
23732406 F966BAB208F27A39005CB29B /* tkButton.c */,
23742407 F966BAB308F27A39005CB29B /* tkButton.h */,
23752408 F966BAB408F27A39005CB29B /* tkCanvArc.c */,
24822515 F966BB6208F27A3A005CB29B /* dialog.tcl */,
24832516 F966BB6308F27A3A005CB29B /* entry.tcl */,
24842517 F966BB6408F27A3A005CB29B /* focus.tcl */,
2518 F99388380EE0114B0065FE6B /* fontchooser.tcl */,
24852519 F966BB7308F27A3A005CB29B /* listbox.tcl */,
24862520 F966BB7408F27A3A005CB29B /* menu.tcl */,
24872521 F966BB7508F27A3A005CB29B /* mkpsenc.tcl */,
24902524 F966BB8708F27A3A005CB29B /* optMenu.tcl */,
24912525 F966BB8808F27A3A005CB29B /* palette.tcl */,
24922526 F966BB8908F27A3B005CB29B /* panedwindow.tcl */,
2493 F966BB8A08F27A3B005CB29B /* prolog.ps */,
24942527 F966BB8B08F27A3B005CB29B /* safetk.tcl */,
24952528 F966BB8C08F27A3B005CB29B /* scale.tcl */,
24962529 F966BB8D08F27A3B005CB29B /* scrlbar.tcl */,
25302563 F966BB2C08F27A39005CB29B /* entry3.tcl */,
25312564 F966BB2D08F27A39005CB29B /* filebox.tcl */,
25322565 F966BB2E08F27A39005CB29B /* floor.tcl */,
2566 F91543270EF201A90032D1E8 /* fontchoose.tcl */,
25332567 F966BB2F08F27A39005CB29B /* form.tcl */,
25342568 F966BB3008F27A39005CB29B /* goldberg.tcl */,
25352569 F966BB3108F27A39005CB29B /* hello */,
26872721 F966BC2A08F27A3C005CB29B /* focus.test */,
26882722 F966BC2B08F27A3C005CB29B /* focusTcl.test */,
26892723 F966BC2C08F27A3C005CB29B /* font.test */,
2724 F99388950EE02D980065FE6B /* fontchooser.test */,
26902725 F966BC2D08F27A3C005CB29B /* frame.test */,
26912726 F966BC2E08F27A3C005CB29B /* geometry.test */,
26922727 F966BC2F08F27A3C005CB29B /* get.test */,
28982933 isa = PBXGroup;
28992934 children = (
29002935 F966C07408F2820D005CB29B /* CoreFoundation.framework */,
2936 F96437E60EF0D652003F468E /* libz.dylib */,
29012937 F966C07608F2821B005CB29B /* Carbon.framework */,
29022938 F966C07808F28233005CB29B /* IOKit.framework */,
29032939 F9FD32140CC1AF170073837D /* libX11.dylib */,
29783014 F968884C0AF787B3000797B5 /* ttk.tcl */,
29793015 F968884D0AF787B3000797B5 /* utils.tcl */,
29803016 F968884E0AF787B3000797B5 /* winTheme.tcl */,
3017 F973E5960EE99384001A648E /* vistaTheme.tcl */,
29813018 F968884F0AF787B3000797B5 /* xpTheme.tcl */,
29823019 );
29833020 path = ttk;
30173054 F96D434408F272B5004A47F5 /* tests */,
30183055 F96D3DFC08F272A4004A47F5 /* doc */,
30193056 F96D43D008F272B8004A47F5 /* tools */,
3057 F9183E690EFC81560030B814 /* pkgs */,
30203058 F96D3DFA08F272A4004A47F5 /* ChangeLog */,
30213059 F96D3DFB08F272A4004A47F5 /* changes */,
30223060 F96D434308F272B5004A47F5 /* README */,
32363274 F96D3EAB08F272A7004A47F5 /* SubstObj.3 */,
32373275 F96D3EAC08F272A7004A47F5 /* switch.n */,
32383276 F96D3EAD08F272A7004A47F5 /* Tcl.n */,
3277 F99D61180EF5573A00BBFE01 /* TclZlib.3 */,
32393278 F96D3EAE08F272A7004A47F5 /* Tcl_Main.3 */,
32403279 F96D3EAF08F272A7004A47F5 /* TCL_MEM_DEBUG.3 */,
32413280 F96D3EB008F272A7004A47F5 /* tclsh.1 */,
32433282 F96D3EB208F272A7004A47F5 /* tclvars.n */,
32443283 F96D3EB308F272A7004A47F5 /* tell.n */,
32453284 F96D3EB408F272A7004A47F5 /* Thread.3 */,
3285 F9183E640EFC80CD0030B814 /* throw.n */,
32463286 F96D3EB508F272A7004A47F5 /* time.n */,
32473287 F96D3EB608F272A7004A47F5 /* tm.n */,
32483288 F96D3EB708F272A7004A47F5 /* ToUpper.3 */,
32503290 F96D3EB908F272A7004A47F5 /* TraceCmd.3 */,
32513291 F96D3EBA08F272A7004A47F5 /* TraceVar.3 */,
32523292 F96D3EBB08F272A7004A47F5 /* Translate.3 */,
3293 F9183E650EFC80D70030B814 /* try.n */,
32533294 F96D3EBC08F272A7004A47F5 /* UniCharIsAlpha.3 */,
32543295 F96D3EBD08F272A7004A47F5 /* unknown.n */,
32553296 F96D3EBE08F272A7004A47F5 /* unload.n */,
32633304 F96D3EC608F272A7004A47F5 /* vwait.n */,
32643305 F96D3EC708F272A7004A47F5 /* while.n */,
32653306 F96D3EC808F272A7004A47F5 /* WrongNumArgs.3 */,
3307 F915432D0EF201EE0032D1E8 /* zlib.n */,
32663308 );
32673309 path = doc;
32683310 sourceTree = "<group>";
33913433 F96D3F3408F272A7004A47F5 /* tclUtf.c */,
33923434 F96D3F3508F272A7004A47F5 /* tclUtil.c */,
33933435 F96D3F3608F272A7004A47F5 /* tclVar.c */,
3436 F96437C90EF0D4B2003F468E /* tclZlib.c */,
33943437 F96D3F3708F272A7004A47F5 /* tommath.h */,
33953438 );
33963439 path = generic;
37773820 F96D43CD08F272B7004A47F5 /* winNotify.test */,
37783821 F96D43CE08F272B7004A47F5 /* winPipe.test */,
37793822 F96D43CF08F272B7004A47F5 /* winTime.test */,
3823 F915432A0EF201CF0032D1E8 /* zlib.test */,
37803824 );
37813825 path = tests;
37823826 sourceTree = "<group>";
42324276 F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */,
42334277 F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */,
42344278 F96D45D508F272BC004A47F5 /* tclVar.c in Sources */,
4279 F96437CA0EF0D4B2003F468E /* tclZlib.c in Sources */,
42354280 F96D48E208F272C3004A47F5 /* bn_fast_s_mp_mul_digs.c in Sources */,
42364281 F96D48E408F272C3004A47F5 /* bn_fast_s_mp_sqr.c in Sources */,
42374282 F96D48E708F272C3004A47F5 /* bn_mp_add.c in Sources */,
43144359 F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */,
43154360 F966BDD308F27A3F005CB29B /* tkBind.c in Sources */,
43164361 F966BDD408F27A3F005CB29B /* tkBitmap.c in Sources */,
4362 F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */,
43174363 F966BDD508F27A3F005CB29B /* tkButton.c in Sources */,
43184364 F966BDD708F27A3F005CB29B /* tkCanvArc.c in Sources */,
43194365 F966BDD808F27A3F005CB29B /* tkCanvas.c in Sources */,
45444590 F9FD31000CC1AD070073837D /* tclUtf.c in Sources */,
45454591 F9FD31010CC1AD070073837D /* tclUtil.c in Sources */,
45464592 F9FD31020CC1AD070073837D /* tclVar.c in Sources */,
4593 F96437CB0EF0D4B2003F468E /* tclZlib.c in Sources */,
45474594 F9FD31030CC1AD070073837D /* bn_fast_s_mp_mul_digs.c in Sources */,
45484595 F9FD31040CC1AD070073837D /* bn_fast_s_mp_sqr.c in Sources */,
45494596 F9FD31050CC1AD070073837D /* bn_mp_add.c in Sources */,
46264673 F9FD31510CC1AD070073837D /* tkAtom.c in Sources */,
46274674 F9FD31520CC1AD070073837D /* tkBind.c in Sources */,
46284675 F9FD31530CC1AD070073837D /* tkBitmap.c in Sources */,
4676 F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */,
46294677 F9FD31540CC1AD070073837D /* tkButton.c in Sources */,
46304678 F9FD31550CC1AD070073837D /* tkCanvArc.c in Sources */,
46314679 F9FD31560CC1AD070073837D /* tkCanvas.c in Sources */,
13441344 TK_VERSION=8.6
13451345 TK_MAJOR_VERSION=8
13461346 TK_MINOR_VERSION=6
1347 TK_PATCH_LEVEL="a3"
1347 TK_PATCH_LEVEL="b1"
13481348 VERSION=${TK_VERSION}
13491349 LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
13501350
26102610 ac_compiler_gnu=$ac_cv_c_compiler_gnu
26112611
26122612
2613 echo "$as_me:$LINENO: checking for inline" >&5
2614 echo $ECHO_N "checking for inline... $ECHO_C" >&6
2615 if test "${ac_cv_c_inline+set}" = set; then
2616 echo $ECHO_N "(cached) $ECHO_C" >&6
2617 else
2618 ac_cv_c_inline=no
2619 for ac_kw in inline __inline__ __inline; do
2620 cat >conftest.$ac_ext <<_ACEOF
2621 /* confdefs.h. */
2622 _ACEOF
2623 cat confdefs.h >>conftest.$ac_ext
2624 cat >>conftest.$ac_ext <<_ACEOF
2625 /* end confdefs.h. */
2626 #ifndef __cplusplus
2627 typedef int foo_t;
2628 static $ac_kw foo_t static_foo () {return 0; }
2629 $ac_kw foo_t foo () {return 0; }
2630 #endif
2631
2632 _ACEOF
2633 rm -f conftest.$ac_objext
2634 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2635 (eval $ac_compile) 2>conftest.er1
2636 ac_status=$?
2637 grep -v '^ *+' conftest.er1 >conftest.err
2638 rm -f conftest.er1
2639 cat conftest.err >&5
2640 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2641 (exit $ac_status); } &&
2642 { ac_try='test -z "$ac_c_werror_flag"
2643 || test ! -s conftest.err'
2644 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2645 (eval $ac_try) 2>&5
2646 ac_status=$?
2647 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2648 (exit $ac_status); }; } &&
2649 { ac_try='test -s conftest.$ac_objext'
2650 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2651 (eval $ac_try) 2>&5
2652 ac_status=$?
2653 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2654 (exit $ac_status); }; }; then
2655 ac_cv_c_inline=$ac_kw; break
2656 else
2657 echo "$as_me: failed program was:" >&5
2658 sed 's/^/| /' conftest.$ac_ext >&5
2659
2660 fi
2661 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2662 done
2663
2664 fi
2665 echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
2666 echo "${ECHO_T}$ac_cv_c_inline" >&6
2667
2668
2669 case $ac_cv_c_inline in
2670 inline | yes) ;;
2671 *)
2672 case $ac_cv_c_inline in
2673 no) ac_val=;;
2674 *) ac_val=$ac_cv_c_inline;;
2675 esac
2676 cat >>confdefs.h <<_ACEOF
2677 #ifndef __cplusplus
2678 #define inline $ac_val
2679 #endif
2680 _ACEOF
2681 ;;
2682 esac
2683
2684
26132685 # limits header checks must come early to prevent
26142686 # an autoconf bug that throws errors on configure
2615
26162687 ac_ext=c
26172688 ac_cpp='$CPP $CPPFLAGS'
26182689 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
44564527 ECHO_VERSION='`echo ${VERSION}`'
44574528 TCL_LIB_VERSIONS_OK=ok
44584529 CFLAGS_DEBUG=-g
4459 CFLAGS_OPTIMIZE=-O
44604530 if test "$GCC" = yes; then
44614531
4462 CFLAGS_WARNING="-Wall -Wno-implicit-int"
4463
4464 else
4465 CFLAGS_WARNING=""
4532 CFLAGS_OPTIMIZE="-O2"
4533 CFLAGS_WARNING="-Wall"
4534
4535 else
4536
4537 CFLAGS_OPTIMIZE=-O
4538 CFLAGS_WARNING=""
4539
44664540 fi
44674541
44684542 TCL_NEEDS_EXP_FILE=0
49285002 DL_LIBS="-ldld"
49295003 LDFLAGS="$LDFLAGS -Wl,-E"
49305004 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
4931 LD_SEARCH_FLAGS='-Wl,+s +b ${LIB_RUNTIME_DIR}:.'
5005 LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
49325006 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
49335007
49345008 fi
1010 * See the file "license.terms" for information on usage and redistribution
1111 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkMacOSXButton.c,v 1.32 2007/12/13 15:27:08 dgp Exp $
13 * RCS: @(#) $Id: tkMacOSXButton.c,v 1.33 2008/12/07 16:30:59 das Exp $
1414 */
1515
1616 #include "tkMacOSXPrivate.h"
485485
486486 Tk_Draw3DRectangle(tkwin, pixmap, dpPtr->border, inset, inset,
487487 Tk_Width(tkwin) - 2*inset, Tk_Height(tkwin) - 2*inset,
488 butPtr->borderWidth, dpPtr->relief);
488 borderWidth, dpPtr->relief);
489489 }
490490 }
491491 if (portChanged) {
5959 * software in accordance with the terms specified in this
6060 * license.
6161 *
62 * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.20 2008/06/19 00:16:11 das Exp $
62 * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.22 2008/12/10 05:02:52 das Exp $
6363 */
6464
6565 #include "tkMacOSXPrivate.h"
210210 {kEventClassApplication, kEventAppShown},
211211 {kEventClassApplication, kEventAppAvailableWindowBoundsChanged},
212212 {kEventClassAppearance, kEventAppearanceScrollBarVariantChanged},
213 {kEventClassFont, kEventFontPanelClosed},
214 {kEventClassFont, kEventFontSelection},
213215 };
214216
215217 carbonEventHandlerUPP = NewEventHandlerUPP(CarbonEventHandlerProc);
587589 */
588590
589591 MODULE_SCOPE void
590 TkMacOSXTrackingLoop(int tracking)
592 TkMacOSXTrackingLoop(
593 int tracking)
591594 {
592595 static int previousServiceMode = TCL_SERVICE_NONE;
593596
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.13 2008/10/05 21:26:11 dkf Exp $
12 * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.14 2008/10/27 11:55:44 dkf Exp $
1313 */
1414
1515 #include "tkMacOSXPrivate.h"
129129
130130 Tcl_ExternalToUtfDString(TkMacOSXCarbonEncoding, buf, length,
131131 &encodedText);
132 result = (*proc)(clientData, interp,
133 Tcl_DStringValue(&encodedText));
132 result = proc(clientData, interp, Tcl_DStringValue(&encodedText));
134133 Tcl_DStringFree(&encodedText);
135134
136135 ckfree(buf);
00 /*
11 * tkMacOSXDebug.c --
22 *
3 * Implementation of Macintosh specific functions for debugging MacOS events,
4 * regions, etc...
3 * Implementation of Macintosh specific functions for debugging MacOS
4 * events, regions, etc...
55 *
66 * Copyright 2001, Apple Computer, Inc.
77 * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
5353 * software in accordance with the terms specified in this
5454 * license.
5555 *
56 * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.20 2008/06/19 00:14:56 das Exp $
56 * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.22 2008/11/08 18:44:40 dkf Exp $
5757 */
5858
5959 #include "tkMacOSXPrivate.h"
7272 } MyEventNameList;
7373
7474 static MyEventName windowEventNames [] = {
75 { kEventWindowUpdate,"Update"},
76 { kEventWindowDrawContent,"DrawContent"},
77 { kEventWindowActivated,"Activated"},
78 { kEventWindowDeactivated,"Deactivated"},
79 { kEventWindowGetClickActivation,"GetClickActivation"},
80 { kEventWindowShowing,"Showing"},
81 { kEventWindowHiding,"Hiding"},
82 { kEventWindowShown,"Shown"},
83 { kEventWindowHidden,"Hidden"},
84 { kEventWindowBoundsChanging,"BoundsChanging"},
85 { kEventWindowBoundsChanged,"BoundsChanged"},
86 { kEventWindowResizeStarted,"ResizeStarted"},
87 { kEventWindowResizeCompleted,"ResizeCompleted"},
88 { kEventWindowDragStarted,"DragStarted"},
89 { kEventWindowDragCompleted,"DragCompleted"},
90 { kEventWindowClickDragRgn,"ClickDragRgn"},
91 { kEventWindowClickResizeRgn,"ClickResizeRgn"},
92 { kEventWindowClickCollapseRgn,"ClickCollapseRgn"},
93 { kEventWindowClickCloseRgn,"ClickCloseRgn"},
94 { kEventWindowClickZoomRgn,"ClickZoomRgn"},
95 { kEventWindowClickContentRgn,"ClickContentRgn"},
96 { kEventWindowClickProxyIconRgn,"ClickProxyIconRgn"},
97 { kEventWindowCursorChange,"CursorChange" },
98 { kEventWindowCollapse,"Collapse"},
99 { kEventWindowCollapsed,"Collapsed"},
100 { kEventWindowCollapseAll,"CollapseAll"},
101 { kEventWindowExpand,"Expand"},
102 { kEventWindowExpanded,"Expanded"},
103 { kEventWindowExpandAll,"ExpandAll"},
104 { kEventWindowCollapse,"Collapse"},
105 { kEventWindowClose,"Close"},
106 { kEventWindowClosed,"Closed"},
107 { kEventWindowCloseAll,"CloseAll"},
108 { kEventWindowZoom,"Zoom"},
109 { kEventWindowZoomed,"Zoomed"},
110 { kEventWindowZoomAll,"ZoomAll"},
111 { kEventWindowContextualMenuSelect,"ContextualMenuSelect"},
112 { kEventWindowPathSelect,"PathSelect"},
113 { kEventWindowGetIdealSize,"GetIdealSize"},
114 { kEventWindowGetMinimumSize,"GetMinimumSize"},
115 { kEventWindowGetMaximumSize,"GetMaximumSize"},
116 { kEventWindowConstrain,"Constrain"},
117 { kEventWindowHandleContentClick,"HandleContentClick"},
118 { kEventWindowProxyBeginDrag,"ProxyBeginDra}"},
119 { kEventWindowProxyEndDrag,"ProxyEndDrag"},
120 { kEventWindowFocusAcquired,"FocusAcquired"},
121 { kEventWindowFocusRelinquish,"FocusRelinquish"},
122 { kEventWindowDrawFrame,"DrawFrame"},
123 { kEventWindowDrawPart,"DrawPart"},
124 { kEventWindowGetRegion,"GetRegion"},
125 { kEventWindowHitTest,"HitTest"},
126 { kEventWindowInit,"Init"},
127 { kEventWindowDispose,"Dispose"},
128 { kEventWindowDragHilite,"DragHilite"},
129 { kEventWindowModified,"Modified"},
130 { kEventWindowSetupProxyDragImage,"SetupProxyDragImage"},
131 { kEventWindowStateChanged,"StateChanged"},
132 { kEventWindowMeasureTitle,"MeasureTitle"},
133 { kEventWindowDrawGrowBox,"DrawGrowBox"},
134 { kEventWindowGetGrowImageRegion,"GetGrowImageRegion"},
135 { kEventWindowPaint,"Paint"},
136 { 0, NULL },
75 { kEventWindowUpdate,"Update"},
76 { kEventWindowDrawContent,"DrawContent"},
77 { kEventWindowActivated,"Activated"},
78 { kEventWindowDeactivated,"Deactivated"},
79 { kEventWindowGetClickActivation,"GetClickActivation"},
80 { kEventWindowShowing,"Showing"},
81 { kEventWindowHiding,"Hiding"},
82 { kEventWindowShown,"Shown"},
83 { kEventWindowHidden,"Hidden"},
84 { kEventWindowBoundsChanging,"BoundsChanging"},
85 { kEventWindowBoundsChanged,"BoundsChanged"},
86 { kEventWindowResizeStarted,"ResizeStarted"},
87 { kEventWindowResizeCompleted,"ResizeCompleted"},
88 { kEventWindowDragStarted,"DragStarted"},
89 { kEventWindowDragCompleted,"DragCompleted"},
90 { kEventWindowClickDragRgn,"ClickDragRgn"},
91 { kEventWindowClickResizeRgn,"ClickResizeRgn"},
92 { kEventWindowClickCollapseRgn,"ClickCollapseRgn"},
93 { kEventWindowClickCloseRgn,"ClickCloseRgn"},
94 { kEventWindowClickZoomRgn,"ClickZoomRgn"},
95 { kEventWindowClickContentRgn,"ClickContentRgn"},
96 { kEventWindowClickProxyIconRgn,"ClickProxyIconRgn"},
97 { kEventWindowCursorChange,"CursorChange" },
98 { kEventWindowCollapse,"Collapse"},
99 { kEventWindowCollapsed,"Collapsed"},
100 { kEventWindowCollapseAll,"CollapseAll"},
101 { kEventWindowExpand,"Expand"},
102 { kEventWindowExpanded,"Expanded"},
103 { kEventWindowExpandAll,"ExpandAll"},
104 { kEventWindowCollapse,"Collapse"},
105 { kEventWindowClose,"Close"},
106 { kEventWindowClosed,"Closed"},
107 { kEventWindowCloseAll,"CloseAll"},
108 { kEventWindowZoom,"Zoom"},
109 { kEventWindowZoomed,"Zoomed"},
110 { kEventWindowZoomAll,"ZoomAll"},
111 { kEventWindowContextualMenuSelect,"ContextualMenuSelect"},
112 { kEventWindowPathSelect,"PathSelect"},
113 { kEventWindowGetIdealSize,"GetIdealSize"},
114 { kEventWindowGetMinimumSize,"GetMinimumSize"},
115 { kEventWindowGetMaximumSize,"GetMaximumSize"},
116 { kEventWindowConstrain,"Constrain"},
117 { kEventWindowHandleContentClick,"HandleContentClick"},
118 { kEventWindowProxyBeginDrag,"ProxyBeginDra}"},
119 { kEventWindowProxyEndDrag,"ProxyEndDrag"},
120 { kEventWindowFocusAcquired,"FocusAcquired"},
121 { kEventWindowFocusRelinquish,"FocusRelinquish"},
122 { kEventWindowDrawFrame,"DrawFrame"},
123 { kEventWindowDrawPart,"DrawPart"},
124 { kEventWindowGetRegion,"GetRegion"},
125 { kEventWindowHitTest,"HitTest"},
126 { kEventWindowInit,"Init"},
127 { kEventWindowDispose,"Dispose"},
128 { kEventWindowDragHilite,"DragHilite"},
129 { kEventWindowModified,"Modified"},
130 { kEventWindowSetupProxyDragImage,"SetupProxyDragImage"},
131 { kEventWindowStateChanged,"StateChanged"},
132 { kEventWindowMeasureTitle,"MeasureTitle"},
133 { kEventWindowDrawGrowBox,"DrawGrowBox"},
134 { kEventWindowGetGrowImageRegion,"GetGrowImageRegion"},
135 { kEventWindowPaint,"Paint"},
136 { 0, NULL },
137137 };
138138
139139 static MyEventName mouseEventNames [] = {
140 { kEventMouseMoved, "Moved"},
141 { kEventMouseUp, "Up"},
142 { kEventMouseDown, "Down"},
143 { kEventMouseDragged, "Dragged"},
144 { kEventMouseWheelMoved, "WheelMoved"},
145 { 0, NULL}
140 { kEventMouseMoved, "Moved"},
141 { kEventMouseUp, "Up"},
142 { kEventMouseDown, "Down"},
143 { kEventMouseDragged, "Dragged"},
144 { kEventMouseWheelMoved, "WheelMoved"},
145 { 0, NULL}
146146 };
147147
148148 static MyEventName keyboardEventNames [] = {
149 { kEventRawKeyDown, "Down"},
150 { kEventRawKeyRepeat, "Repeat"},
151 { kEventRawKeyUp, "Up"},
152 { kEventRawKeyModifiersChanged, "ModifiersChanged"},
153 { kEventHotKeyPressed, "HotKeyPressed"},
154 { kEventHotKeyReleased, "HotKeyReleased"},
155 { 0, NULL}
149 { kEventRawKeyDown, "Down"},
150 { kEventRawKeyRepeat, "Repeat"},
151 { kEventRawKeyUp, "Up"},
152 { kEventRawKeyModifiersChanged, "ModifiersChanged"},
153 { kEventHotKeyPressed, "HotKeyPressed"},
154 { kEventHotKeyReleased, "HotKeyReleased"},
155 { 0, NULL}
156156 };
157157
158158 static MyEventName appEventNames [] = {
159 { kEventAppActivated, "Activated"},
160 { kEventAppDeactivated, "Deactivated"},
161 { kEventAppQuit, "Quit"},
162 { kEventAppLaunchNotification, "LaunchNotification"},
163 { kEventAppLaunched, "Launched"},
164 { kEventAppTerminated, "Terminated"},
165 { kEventAppFrontSwitched, "FrontSwitched"},
166 { 0, NULL}
159 { kEventAppActivated, "Activated"},
160 { kEventAppDeactivated, "Deactivated"},
161 { kEventAppQuit, "Quit"},
162 { kEventAppLaunchNotification, "LaunchNotification"},
163 { kEventAppLaunched, "Launched"},
164 { kEventAppTerminated, "Terminated"},
165 { kEventAppFrontSwitched, "FrontSwitched"},
166 { 0, NULL}
167167 };
168168
169169 static MyEventName menuEventNames [] = {
170 { kEventMenuBeginTracking, "BeginTracking"},
171 { kEventMenuEndTracking, "EndTracking"},
172 { kEventMenuChangeTrackingMode, "ChangeTrackingMode"},
173 { kEventMenuOpening, "Opening"},
174 { kEventMenuClosed, "Closed"},
175 { kEventMenuTargetItem, "TargetItem"},
176 { kEventMenuMatchKey, "MatchKey"},
177 { kEventMenuEnableItems, "EnableItems"},
178 { kEventMenuDispose, "Dispose"},
179 { 0, NULL }
170 { kEventMenuBeginTracking, "BeginTracking"},
171 { kEventMenuEndTracking, "EndTracking"},
172 { kEventMenuChangeTrackingMode, "ChangeTrackingMode"},
173 { kEventMenuOpening, "Opening"},
174 { kEventMenuClosed, "Closed"},
175 { kEventMenuTargetItem, "TargetItem"},
176 { kEventMenuMatchKey, "MatchKey"},
177 { kEventMenuEnableItems, "EnableItems"},
178 { kEventMenuDispose, "Dispose"},
179 { 0, NULL }
180180 };
181181
182182 static MyEventName controlEventNames [] = {
183 { kEventControlInitialize, "Initialize" },
184 { kEventControlDispose, "Dispose" },
185 { kEventControlGetOptimalBounds, "GetOptimalBounds" },
186 { kEventControlHit, "Hit" },
187 { kEventControlSimulateHit, "SimulateHit" },
188 { kEventControlHitTest, "HitTest" },
189 { kEventControlDraw, "Draw" },
190 { kEventControlApplyBackground, "ApplyBackground" },
191 { kEventControlApplyTextColor, "ApplyTextColor" },
192 { kEventControlSetFocusPart, "SetFocusPart" },
193 { kEventControlGetFocusPart, "GetFocusPart" },
194 { kEventControlActivate, "Activate" },
195 { kEventControlDeactivate, "Deactivate" },
196 { kEventControlSetCursor, "SetCursor" },
197 { kEventControlContextualMenuClick, "ContextualMenuClick" },
198 { kEventControlClick, "Click" },
199 { kEventControlTrack, "Track" },
200 { kEventControlGetScrollToHereStartPoint, "GetScrollToHereStartPoint" },
201 { kEventControlGetIndicatorDragConstraint, "GetIndicatorDragConstraint" },
202 { kEventControlIndicatorMoved, "IndicatorMoved" },
203 { kEventControlGhostingFinished, "GhostingFinished" },
204 { kEventControlGetActionProcPart, "GetActionProcPart" },
205 { kEventControlGetPartRegion, "GetPartRegion" },
206 { kEventControlGetPartBounds, "GetPartBounds" },
207 { kEventControlSetData, "SetData" },
208 { kEventControlGetData, "GetData" },
209 { kEventControlValueFieldChanged, "ValueFieldChanged" },
210 { kEventControlAddedSubControl, "AddedSubControl" },
211 { kEventControlRemovingSubControl, "RemovingSubControl" },
212 { kEventControlBoundsChanged, "BoundsChanged" },
213 { kEventControlOwningWindowChanged, "OwningWindowChanged" },
214 { kEventControlArbitraryMessage, "ArbitraryMessage" },
215 { 0, NULL }
183 { kEventControlInitialize, "Initialize" },
184 { kEventControlDispose, "Dispose" },
185 { kEventControlGetOptimalBounds, "GetOptimalBounds" },
186 { kEventControlHit, "Hit" },
187 { kEventControlSimulateHit, "SimulateHit" },
188 { kEventControlHitTest, "HitTest" },
189 { kEventControlDraw, "Draw" },
190 { kEventControlApplyBackground, "ApplyBackground" },
191 { kEventControlApplyTextColor, "ApplyTextColor" },
192 { kEventControlSetFocusPart, "SetFocusPart" },
193 { kEventControlGetFocusPart, "GetFocusPart" },
194 { kEventControlActivate, "Activate" },
195 { kEventControlDeactivate, "Deactivate" },
196 { kEventControlSetCursor, "SetCursor" },
197 { kEventControlContextualMenuClick, "ContextualMenuClick" },
198 { kEventControlClick, "Click" },
199 { kEventControlTrack, "Track" },
200 { kEventControlGetScrollToHereStartPoint, "GetScrollToHereStartPoint" },
201 { kEventControlGetIndicatorDragConstraint, "GetIndicatorDragConstraint" },
202 { kEventControlIndicatorMoved, "IndicatorMoved" },
203 { kEventControlGhostingFinished, "GhostingFinished" },
204 { kEventControlGetActionProcPart, "GetActionProcPart" },
205 { kEventControlGetPartRegion, "GetPartRegion" },
206 { kEventControlGetPartBounds, "GetPartBounds" },
207 { kEventControlSetData, "SetData" },
208 { kEventControlGetData, "GetData" },
209 { kEventControlValueFieldChanged, "ValueFieldChanged" },
210 { kEventControlAddedSubControl, "AddedSubControl" },
211 { kEventControlRemovingSubControl, "RemovingSubControl" },
212 { kEventControlBoundsChanged, "BoundsChanged" },
213 { kEventControlOwningWindowChanged, "OwningWindowChanged" },
214 { kEventControlArbitraryMessage, "ArbitraryMessage" },
215 { 0, NULL }
216216 };
217217
218218 static MyEventName commandEventNames [] = {
219 { kEventCommandProcess, "Process" },
220 { kEventCommandUpdateStatus, "UpdateStatus" },
221 { 0, NULL }
219 { kEventCommandProcess, "Process" },
220 { kEventCommandUpdateStatus, "UpdateStatus" },
221 { 0, NULL }
222222 };
223223
224224 static MyEventNameList eventNameList [] = {
225 { kEventClassWindow, windowEventNames },
226 { kEventClassMouse, mouseEventNames },
227 { kEventClassKeyboard, keyboardEventNames },
228 { kEventClassApplication, appEventNames },
229 { kEventClassMenu, menuEventNames },
230 { kEventClassControl, controlEventNames },
231 { kEventClassCommand, commandEventNames },
232 { 0, NULL}
225 { kEventClassWindow, windowEventNames },
226 { kEventClassMouse, mouseEventNames },
227 { kEventClassKeyboard, keyboardEventNames },
228 { kEventClassApplication, appEventNames },
229 { kEventClassMenu, menuEventNames },
230 { kEventClassControl, controlEventNames },
231 { kEventClassCommand, commandEventNames },
232 { 0, NULL}
233233 };
234234
235235 #ifdef TK_MACOSXDEBUG_UNUSED
236236 static MyEventName classicEventNames [] = {
237 { nullEvent,"nullEvent" },
238 { mouseDown,"mouseDown" },
239 { mouseUp,"mouseUp" },
240 { keyDown,"keyDown" },
241 { keyUp,"keyUp" },
242 { autoKey,"autoKey" },
243 { updateEvt,"updateEvt" },
244 { diskEvt,"diskEvt" },
245 { activateEvt,"activateEvt" },
246 { osEvt,"osEvt" },
247 { kHighLevelEvent,"kHighLevelEvent" },
248 { 0, NULL }
237 { nullEvent,"nullEvent" },
238 { mouseDown,"mouseDown" },
239 { mouseUp,"mouseUp" },
240 { keyDown,"keyDown" },
241 { keyUp,"keyUp" },
242 { autoKey,"autoKey" },
243 { updateEvt,"updateEvt" },
244 { diskEvt,"diskEvt" },
245 { activateEvt,"activateEvt" },
246 { osEvt,"osEvt" },
247 { kHighLevelEvent,"kHighLevelEvent" },
248 { 0, NULL }
249249 };
250250 #endif /* TK_MACOSXDEBUG_UNUSED */
251251
252252 MODULE_SCOPE char *
253 TkMacOSXCarbonEventToAscii(EventRef eventRef)
253 TkMacOSXCarbonEventToAscii(
254 EventRef eventRef)
254255 {
255256 EventClass eventClass;
256257 EventKind eventKind;
275276 list++;
276277 }
277278 }
278 while (names && names->name) {
279 while (names && names->name) {
279280 if (eventKind == names->kind) {
280281 snprintf(buf, 250, "%-20s", names->name);
281282 break;
291292
292293 #ifdef TK_MACOSXDEBUG_UNUSED
293294 MODULE_SCOPE char *
294 TkMacOSXCarbonEventKindToAscii(EventRef eventRef, char * buf )
295 {
296 EventClass eventClass;
297 EventKind eventKind;
298 MyEventNameList * list = eventNameList;
299 MyEventName * names = NULL;
300 int found = 0;
301 eventClass = GetEventClass(eventRef);
302 eventKind = GetEventKind(eventRef);
303 while (list->names && (!names) ) {
304 if (eventClass == list -> c) {
305 names = list -> names;
306 } else {
307 list++;
308 }
309 }
310 if (names) {
311 found = 0;
312 while ( names->name && !found ) {
313 if (eventKind == names->kind) {
314 sprintf(buf,"%s",names->name);
315 found = 1;
316 } else {
317 names++;
318 }
319 }
295 TkMacOSXCarbonEventKindToAscii(
296 EventRef eventRef,
297 char *buf)
298 {
299 EventClass eventClass;
300 EventKind eventKind;
301 MyEventNameList *list = eventNameList;
302 MyEventName *names = NULL;
303 int found = 0;
304
305 eventClass = GetEventClass(eventRef);
306 eventKind = GetEventKind(eventRef);
307 while (list->names && (!names) ) {
308 if (eventClass == list -> c) {
309 names = list -> names;
310 } else {
311 list++;
312 }
313 }
314 if (names) {
315 found = 0;
316 while (names->name && !found) {
317 if (eventKind == names->kind) {
318 sprintf(buf,"%s",names->name);
319 found = 1;
320 } else {
321 names++;
322 }
323 }
320324 }
321325 if (!found) {
322 sprintf ( buf,"%d", eventKind );
323 } else {
324 sprintf ( buf,"%d", eventKind );
325 }
326 return buf;
326 sprintf(buf,"%d", eventKind);
327 } else {
328 sprintf(buf,"%d", eventKind);
329 }
330 return buf;
327331 }
328332
329333 MODULE_SCOPE char *
330 TkMacOSXClassicEventToAscii(EventRecord * eventPtr, char * buf )
331 {
332 MyEventName * names = NULL;
334 TkMacOSXClassicEventToAscii(
335 EventRecord *eventPtr,
336 char *buf)
337 {
338 MyEventName *names = NULL;
333339 int found = 0;
334340 names = classicEventNames;
335 while ( names -> name && !found )
341 while (names -> name && !found) {
336342 if (eventPtr->what == names->kind) {
337 int * iPtr;
343 int *iPtr;
338344 char cBuf[8];
339 iPtr=(int *) &cBuf;
345
346 iPtr = (int *) &cBuf;
340347 *iPtr = eventPtr->message;
341348 cBuf[4] = 0;
342349 sprintf(buf, "%-16s %08x %04x %s", names->name,
343 (int) eventPtr->message,
344 eventPtr->modifiers,
345 cBuf);
350 (int) eventPtr->message, eventPtr->modifiers, cBuf);
346351 found = 1;
347352 } else {
348 names++;
349 }
353 names++;
354 }
355 }
350356 if (!found) {
351 sprintf(buf,"%-16d %08x %08x, %s",
352 eventPtr->what, (int) eventPtr->message,
353 eventPtr->modifiers, buf);
357 sprintf(buf,"%-16d %08x %08x, %s", eventPtr->what,
358 (int) eventPtr->message, eventPtr->modifiers, buf);
354359 }
355360 return buf;
356
357361 }
358362
359363 MODULE_SCOPE void
360 TkMacOSXPrintPoint(char * tag, Point * p )
364 TkMacOSXPrintPoint(
365 char *tag,
366 Point *p)
361367 {
362368 TkMacOSXDbgMsg("%s %4d %4d", tag,p->h,p->v );
363369 }
364370
365371 MODULE_SCOPE void
366 TkMacOSXPrintRect(char * tag, Rect * r )
372 TkMacOSXPrintRect(
373 char *tag,
374 Rect *r)
367375 {
368376 TkMacOSXDbgMsg("%s %4d %4d %4d %4d (%dx%d)",
369 tag, r->left, r->top, r->right, r->bottom,
370 r->right - r->left + 1, r->bottom - r->top + 1);
377 tag, r->left, r->top, r->right, r->bottom,
378 r->right - r->left + 1, r->bottom - r->top + 1);
371379 }
372380
373381 MODULE_SCOPE void
374 TkMacOSXPrintRegion(char * tag, RgnHandle rgn )
382 TkMacOSXPrintRegion(
383 char *tag,
384 RgnHandle rgn)
375385 {
376386 Rect r;
387
377388 GetRegionBounds(rgn,&r);
378389 TkMacOSXPrintRect(tag,&r);
379390 }
380391
381392 MODULE_SCOPE void
382 TkMacOSXPrintWindowTitle(char * tag, WindowRef window )
393 TkMacOSXPrintWindowTitle(
394 char *tag,
395 WindowRef window)
383396 {
384397 Str255 title;
385 GetWTitle(window,title);
386 title [title[0] + 1] = 0;
387 TkMacOSXDbgMsg("%s %s", tag, title +1 );
398
399 GetWTitle(window, title);
400 title[title[0] + 1] = 0;
401 TkMacOSXDbgMsg("%s %s", tag, title+1);
388402 }
389403
390404 typedef struct {
391 int msg;
392 char * name;
405 int msg;
406 char *name;
393407 } MsgName;
394408
395409 static MsgName msgNames [] = {
407421 };
408422
409423 MODULE_SCOPE char *
410 TkMacOSXMenuMessageToAscii(int msg, char * s)
411 {
412 MsgName * msgNamePtr;
413 for (msgNamePtr = msgNames;msgNamePtr->name;) {
424 TkMacOSXMenuMessageToAscii(
425 int msg,
426 char *s)
427 {
428 MsgName *msgNamePtr;
429
430 for (msgNamePtr=msgNames ; msgNamePtr->name ; msgNamePtr++) {
414431 if (msgNamePtr->msg == msg) {
415432 strcpy(s,msgNamePtr->name);
416433 return s;
417 } else {
418 msgNamePtr++;
419 }
420 }
421 sprintf(s,"unknown : %d", msg );
434 }
435 }
436 sprintf(s, "unknown : %d", msg);
422437 return s;
423438 }
424439
435450 };
436451
437452 MODULE_SCOPE char *
438 TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char * buf)
439 {
440 MsgName * namePtr;
453 TkMacOSXMouseTrackingResultToAscii(
454 MouseTrackingResult r,
455 char *buf)
456 {
457 MsgName *namePtr;
458
441459 for (namePtr = trackingNames; namePtr->name; namePtr++) {
442460 if (namePtr->msg == r) {
443461 strcpy(buf, namePtr->name);
486504 *
487505 * TkMacOSXGetNamedDebugSymbol --
488506 *
489 *
490 * Dynamically acquire address of a named symbol from a loaded
491 * dynamic library, so that we can use API that may not be
492 * available on all OS versions.
493 * For debugging purposes, if we cannot find the symbol with the
494 * usual dynamic library APIs, we manually walk the symbol table
495 * of the loaded library. This allows access to unexported
496 * symbols such as private_extern internal debugging functions.
497 * If module is NULL or the empty string, search all loaded
498 * libraries (could be very expensive and should be avoided).
499 *
500 * THIS FUCTION IS ONLY TO BE USED FOR DEBUGGING PURPOSES, IT MAY
501 * BREAK UNEXPECTEDLY IN THE FUTURE !
507 * Dynamically acquire address of a named symbol from a loaded dynamic
508 * library, so that we can use API that may not be available on all OS
509 * versions. For debugging purposes, if we cannot find the symbol with
510 * the usual dynamic library APIs, we manually walk the symbol table of
511 * the loaded library. This allows access to unexported symbols such as
512 * private_extern internal debugging functions. If module is NULL or the
513 * empty string, search all loaded libraries (could be very expensive and
514 * should be avoided).
515 *
516 * THIS FUCTION IS ONLY TO BE USED FOR DEBUGGING PURPOSES, IT MAY BREAK
517 * UNEXPECTEDLY IN THE FUTURE!
502518 *
503519 * Results:
504520 * Address of given symbol or NULL if unavailable.
511527
512528 MODULE_SCOPE void *
513529 TkMacOSXGetNamedDebugSymbol(
514 const char* module,
515 const char* symbol)
516 {
517 void* addr = TkMacOSXGetNamedSymbol(module, symbol);
530 const char *module,
531 const char *symbol)
532 {
533 void *addr = TkMacOSXGetNamedSymbol(module, symbol);
534
518535 #ifndef __LP64__
519536 if (!addr) {
520537 const struct mach_header *mh = NULL;
573590 nsect += ns;
574591 }
575592 } else if (!st && lc->cmd == LC_SYMTAB) {
576 st = (struct symtab_command*) lc;
593 st = (struct symtab_command *) lc;
577594 break;
578595 }
579596 lc = (struct load_command *)((char *) lc + lc->cmdsize);
585602 uint32_t strsize = st->strsize;
586603 int32_t strx;
587604
588 /* Offset file positions by difference to actual position
589 in memory of last segment before symbol table: */
605 /*
606 * Offset file positions by difference to actual position
607 * in memory of last segment before symbol table:
608 */
609
590610 base = (intptr_t) sg->vmaddr + slide - sg->fileoff;
591 strings = (char*)(base + st->stroff);
592 sym = (struct nlist*)(base + st->symoff);
611 strings = (char *) (base + st->stroff);
612 sym = (struct nlist *) (base + st->symoff);
593613 m = st->nsyms;
594614 for (j = 0; j < m; j++) {
595615 /* Find symbol with given name in __text section */
614634 #endif /* __LP64__ */
615635 return addr;
616636 }
617
618637 #endif /* TK_MAC_DEBUG */
638
639 /*
640 * Local Variables:
641 * c-basic-offset: 4
642 * fill-column: 78
643 * End:
644 */
1111 * See the file "license.terms" for information on usage and redistribution
1212 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.15 2007/12/13 15:27:08 dgp Exp $
14 * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.17 2008/12/06 10:48:29 dkf Exp $
1515 */
1616
1717 #ifndef _TKMACDEFAULT
2828 * DISABLED - Foreground color when widget is disabled.
2929 */
3030
31 #define BLACK "Black"
32 #define WHITE "White"
33 #define NORMAL_BG "systemWindowBody"
34 #define ACTIVE_BG "systemButtonFacePressed"
35 #define ACTIVE_FG "systemPushButtonPressedText"
36 #define SELECT_BG "systemHighlight"
37 #define SELECT_FG None
38 #define INACTIVE_SELECT_BG "systemHighlightSecondary"
39 #define TROUGH "#c3c3c3"
40 #define INDICATOR "#b03060"
41 #define DISABLED "#a3a3a3"
31 #define BLACK "Black"
32 #define WHITE "White"
33 #define NORMAL_BG "systemWindowBody"
34 #define ACTIVE_BG "systemButtonFacePressed"
35 #define ACTIVE_FG "systemPushButtonPressedText"
36 #define SELECT_BG "systemHighlight"
37 #define SELECT_FG None
38 #define INACTIVE_SELECT_BG "systemHighlightSecondary"
39 #define TROUGH "#c3c3c3"
40 #define INDICATOR "#b03060"
41 #define DISABLED "#a3a3a3"
4242
4343 /*
4444 * Defaults for labels, buttons, checkbuttons, and radiobuttons:
7070 #define DEF_BUTTON_HIGHLIGHT "systemButtonFrame"
7171 #define DEF_LABEL_HIGHLIGHT_WIDTH "0"
7272 #define DEF_BUTTON_HIGHLIGHT_WIDTH "4"
73 #define DEF_BUTTON_IMAGE (char *) NULL
73 #define DEF_BUTTON_IMAGE ((char *) NULL)
7474 #define DEF_BUTTON_INDICATOR "1"
7575 #define DEF_BUTTON_JUSTIFY "center"
7676 #define DEF_BUTTON_OFF_VALUE "0"
8787 #define DEF_BUTTON_REPEAT_INTERVAL "0"
8888 #define DEF_BUTTON_SELECT_COLOR INDICATOR
8989 #define DEF_BUTTON_SELECT_MONO BLACK
90 #define DEF_BUTTON_SELECT_IMAGE (char *) NULL
90 #define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
9191 #define DEF_BUTTON_STATE "normal"
9292 #define DEF_LABEL_TAKE_FOCUS "0"
93 #define DEF_BUTTON_TAKE_FOCUS (char *) NULL
93 #define DEF_BUTTON_TAKE_FOCUS ((char *) NULL)
9494 #define DEF_BUTTON_TEXT ""
9595 #define DEF_BUTTON_TEXT_VARIABLE ""
9696 #define DEF_BUTTON_UNDERLINE "-1"
128128 #define DEF_CANVAS_SELECT_BD_MONO "0"
129129 #define DEF_CANVAS_SELECT_FG_COLOR SELECT_FG
130130 #define DEF_CANVAS_SELECT_FG_MONO WHITE
131 #define DEF_CANVAS_TAKE_FOCUS (char *) NULL
131 #define DEF_CANVAS_TAKE_FOCUS ((char *) NULL)
132132 #define DEF_CANVAS_WIDTH "10c"
133133 #define DEF_CANVAS_X_SCROLL_CMD ""
134134 #define DEF_CANVAS_X_SCROLL_INCREMENT "0"
184184 #define DEF_ENTRY_SELECT_BD_MONO "0"
185185 #define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG
186186 #define DEF_ENTRY_SELECT_FG_MONO WHITE
187 #define DEF_ENTRY_SHOW (char *) NULL
187 #define DEF_ENTRY_SHOW ((char *) NULL)
188188 #define DEF_ENTRY_STATE "normal"
189 #define DEF_ENTRY_TAKE_FOCUS (char *) NULL
189 #define DEF_ENTRY_TAKE_FOCUS ((char *) NULL)
190190 #define DEF_ENTRY_TEXT_VARIABLE ""
191191 #define DEF_ENTRY_WIDTH "20"
192192
252252 #define DEF_LISTBOX_SELECT_MODE "browse"
253253 #define DEF_LISTBOX_SET_GRID "0"
254254 #define DEF_LISTBOX_STATE "normal"
255 #define DEF_LISTBOX_TAKE_FOCUS (char *) NULL
255 #define DEF_LISTBOX_TAKE_FOCUS ((char *) NULL)
256256 #define DEF_LISTBOX_WIDTH "20"
257257
258258 /*
259259 * Defaults for individual entries of menus:
260260 */
261261
262 #define DEF_MENU_ENTRY_ACTIVE_BG (char *) NULL
263 #define DEF_MENU_ENTRY_ACTIVE_FG (char *) NULL
264 #define DEF_MENU_ENTRY_ACCELERATOR (char *) NULL
265 #define DEF_MENU_ENTRY_BG (char *) NULL
262 #define DEF_MENU_ENTRY_ACTIVE_BG ((char *) NULL)
263 #define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL)
264 #define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL)
265 #define DEF_MENU_ENTRY_BG ((char *) NULL)
266266 #define DEF_MENU_ENTRY_BITMAP None
267267 #define DEF_MENU_ENTRY_COLUMN_BREAK "0"
268 #define DEF_MENU_ENTRY_COMMAND (char *) NULL
268 #define DEF_MENU_ENTRY_COMMAND ((char *) NULL)
269269 #define DEF_MENU_ENTRY_COMPOUND "none"
270 #define DEF_MENU_ENTRY_FG (char *) NULL
271 #define DEF_MENU_ENTRY_FONT (char *) NULL
270 #define DEF_MENU_ENTRY_FG ((char *) NULL)
271 #define DEF_MENU_ENTRY_FONT ((char *) NULL)
272272 #define DEF_MENU_ENTRY_HIDE_MARGIN "0"
273 #define DEF_MENU_ENTRY_IMAGE (char *) NULL
273 #define DEF_MENU_ENTRY_IMAGE ((char *) NULL)
274274 #define DEF_MENU_ENTRY_INDICATOR "1"
275 #define DEF_MENU_ENTRY_LABEL (char *) NULL
276 #define DEF_MENU_ENTRY_MENU (char *) NULL
275 #define DEF_MENU_ENTRY_LABEL ((char *) NULL)
276 #define DEF_MENU_ENTRY_MENU ((char *) NULL)
277277 #define DEF_MENU_ENTRY_OFF_VALUE "0"
278278 #define DEF_MENU_ENTRY_ON_VALUE "1"
279 #define DEF_MENU_ENTRY_SELECT_IMAGE (char *) NULL
279 #define DEF_MENU_ENTRY_SELECT_IMAGE ((char *) NULL)
280280 #define DEF_MENU_ENTRY_STATE "normal"
281 #define DEF_MENU_ENTRY_VALUE (char *) NULL
282 #define DEF_MENU_ENTRY_CHECK_VARIABLE (char *) NULL
281 #define DEF_MENU_ENTRY_VALUE ((char *) NULL)
282 #define DEF_MENU_ENTRY_CHECK_VARIABLE ((char *) NULL)
283283 #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
284 #define DEF_MENU_ENTRY_SELECT (char *) NULL
284 #define DEF_MENU_ENTRY_SELECT ((char *) NULL)
285285 #define DEF_MENU_ENTRY_UNDERLINE "-1"
286286
287287 /*
312312 */
313313
314314 #define DEF_MENU_TEAROFF "0"
315 #define DEF_MENU_TEAROFF_CMD (char *) NULL
315 #define DEF_MENU_TEAROFF_CMD ((char *) NULL)
316316 #define DEF_MENU_TITLE ""
317317 #define DEF_MENU_TYPE "normal"
318318
340340 #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
341341 #define DEF_MENUBUTTON_HIGHLIGHT BLACK
342342 #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
343 #define DEF_MENUBUTTON_IMAGE (char *) NULL
343 #define DEF_MENUBUTTON_IMAGE ((char *) NULL)
344344 #define DEF_MENUBUTTON_INDICATOR "0"
345345 /* #define DEF_MENUBUTTON_JUSTIFY "center" */
346346 #define DEF_MENUBUTTON_JUSTIFY "left"
449449 #define DEF_SCALE_SLIDER_LENGTH "30"
450450 #define DEF_SCALE_SLIDER_RELIEF "raised"
451451 #define DEF_SCALE_STATE "normal"
452 #define DEF_SCALE_TAKE_FOCUS (char *) NULL
452 #define DEF_SCALE_TAKE_FOCUS ((char *) NULL)
453453 #define DEF_SCALE_TICK_INTERVAL "0"
454454 #define DEF_SCALE_TO "100"
455455 #define DEF_SCALE_VARIABLE ""
476476 #define DEF_SCROLLBAR_RELIEF "flat"
477477 #define DEF_SCROLLBAR_REPEAT_DELAY "300"
478478 #define DEF_SCROLLBAR_REPEAT_INTERVAL "100"
479 #define DEF_SCROLLBAR_TAKE_FOCUS (char *) NULL
479 #define DEF_SCROLLBAR_TAKE_FOCUS ((char *) NULL)
480480 #define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
481481 #define DEF_SCROLLBAR_TROUGH_MONO WHITE
482482 #define DEF_SCROLLBAR_WIDTH "15"
503503 #define DEF_TEXT_INSERT_BD_MONO "0"
504504 #define DEF_TEXT_INSERT_OFF_TIME "300"
505505 #define DEF_TEXT_INSERT_ON_TIME "600"
506 #define DEF_TEXT_INSERT_UNFOCUSSED "none"
506507 #define DEF_TEXT_INSERT_WIDTH "1"
507508 #define DEF_TEXT_MAX_UNDO "0"
508509 #define DEF_TEXT_PADX "1"
523524 #define DEF_TEXT_STATE "normal"
524525 #define DEF_TEXT_TABS ""
525526 #define DEF_TEXT_TABSTYLE "tabular"
526 #define DEF_TEXT_TAKE_FOCUS (char *) NULL
527 #define DEF_TEXT_TAKE_FOCUS ((char *) NULL)
527528 #define DEF_TEXT_UNDO "0"
528529 #define DEF_TEXT_WIDTH "80"
529530 #define DEF_TEXT_WRAP "char"
546547 #define DEF_TOPLEVEL_SCREEN ""
547548 #define DEF_TOPLEVEL_USE ""
548549
550 /*
551 * Defaults for busy windows (not really used yet):
552 */
553
554 #define DEF_BUSY_CURSOR "watch"
555
549556 #endif /* _TKMACDEFAULT */
44 *
55 * Copyright (c) 1996-1997 Sun Microsystems, Inc.
66 * Copyright 2001, Apple Computer, Inc.
7 * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
7 * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
88 *
99 * See the file "license.terms" for information on usage and redistribution
1010 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.38 2008/09/02 16:10:54 das Exp $
12 * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.43 2008/12/10 05:02:52 das Exp $
1313 */
1414
1515 #include "tkMacOSXPrivate.h"
104104
105105 static NavObjectFilterUPP openFileFilterUPP;
106106 static NavEventUPP openFileEventUPP;
107
107
108108 /*
109109 *----------------------------------------------------------------------
110110 *
134134 Tk_Window parent, tkwin = clientData;
135135 const char *title;
136136 int i, srcRead, dstWrote;
137 CMError cmerr;
138137 CMProfileRef prof;
139138 NColorPickerInfo cpinfo;
140139 static RGBColor color = {0xffff, 0xffff, 0xffff};
141 static const char *optionStrings[] = {
140 static const char *const optionStrings[] = {
142141 "-initialcolor", "-parent", "-title", NULL
143142 };
144143 enum options {
195194 }
196195 }
197196
198 cmerr = CMGetDefaultProfileBySpace(cmRGBData, &prof);
197 ChkErr(CMGetDefaultProfileBySpace, cmRGBData, &prof);
199198 cpinfo.theColor.profile = prof;
200199 cpinfo.dstProfile = prof;
201200 cpinfo.flags = kColorPickerDialogIsMoveable | kColorPickerDialogIsModal;
208207 TkMacOSXTrackingLoop(1);
209208 err = ChkErr(NPickColor, &cpinfo);
210209 TkMacOSXTrackingLoop(0);
211 cmerr = CMCloseProfile(prof);
210 ChkErr(CMCloseProfile, prof);
212211 if ((err == noErr) && (cpinfo.newColorChosen != 0)) {
213212 char colorstr[8];
214213
226225 end:
227226 return result;
228227 }
229
228
230229 /*
231230 *----------------------------------------------------------------------
232231 *
261260 char *initialFile = NULL, *initialDir = NULL;
262261 Tcl_Obj *typeVariablePtr = NULL;
263262 const char *initialtype = NULL;
264 static const char *openOptionStrings[] = {
263 static const char *const openOptionStrings[] = {
265264 "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
266265 "-message", "-multiple", "-parent", "-title", "-typevariable", NULL
267266 };
314313 }
315314 break;
316315 case OPEN_INITFILE:
317 initialFile = Tcl_GetString(objv[i + 1]);
316 initialFile = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
318317 /* empty strings should be like no selection given */
319318 if (choiceLen == 0) {
320319 initialFile = NULL;
322321 break;
323322 case OPEN_MESSAGE:
324323 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
324 if (message) {
325 CFRelease(message);
326 }
325327 message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
326328 choiceLen, kCFStringEncodingUTF8, false);
327329 break;
340342 break;
341343 case OPEN_TITLE:
342344 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
345 if (title) {
346 CFRelease(title);
347 }
343348 title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
344349 choiceLen, kCFStringEncodingUTF8, false);
345350 break;
369374 while (filterPtr && i-- > 0) {
370375 filterPtr = filterPtr->next;
371376 }
372 Tcl_SetVar(interp, Tcl_GetString(typeVariablePtr), filterPtr->name, 0);
377 Tcl_SetVar(interp, Tcl_GetString(typeVariablePtr), filterPtr ?
378 filterPtr->name : "", 0);
373379 }
374380
375381 end:
388394 }
389395 return result;
390396 }
391
397
392398 /*
393399 *----------------------------------------------------------------------
394400 *
419425 FSRef dirRef;
420426 CFStringRef title = NULL, message = NULL;
421427 OpenFileData ofd;
422 static const char *saveOptionStrings[] = {
428 static const char *const saveOptionStrings[] = {
423429 "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
424430 "-message", "-parent", "-title", "-typevariable", NULL
425431 };
477483 break;
478484 case SAVE_MESSAGE:
479485 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
486 if (message) {
487 CFRelease(message);
488 }
480489 message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
481490 choiceLen, kCFStringEncodingUTF8, false);
482491 break;
489498 break;
490499 case SAVE_TITLE:
491500 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
501 if (title) {
502 CFRelease(title);
503 }
492504 title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
493505 choiceLen, kCFStringEncodingUTF8, false);
494506 break;
513525 }
514526 return result;
515527 }
516
528
517529 /*
518530 *----------------------------------------------------------------------
519531 *
545557 FSRef dirRef;
546558 CFStringRef message = NULL, title = NULL;
547559 OpenFileData ofd;
548 static const char *chooseOptionStrings[] = {
560 static const char *const chooseOptionStrings[] = {
549561 "-initialdir", "-message", "-mustexist", "-parent", "-title", NULL
550562 };
551563 enum chooseOptions {
581593 break;
582594 case CHOOSE_MESSAGE:
583595 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
596 if (message) {
597 CFRelease(message);
598 }
584599 message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
585600 choiceLen, kCFStringEncodingUTF8, false);
586601 break;
593608 break;
594609 case CHOOSE_TITLE:
595610 choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
611 if (title) {
612 CFRelease(title);
613 }
596614 title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
597615 choiceLen, kCFStringEncodingUTF8, false);
598616 break;
619637 }
620638 return result;
621639 }
622
640
623641 /*
624642 *----------------------------------------------------------------------
625643 *
704722 }
705723 return result;
706724 }
707
725
708726 /*
709727 *----------------------------------------------------------------------
710728 *
728746 openFileFilterUPP = NewNavObjectFilterUPP(OpenFileFilterProc);
729747 openFileEventUPP = NewNavEventUPP(OpenEventProc);
730748 }
731
749
732750 /*
733751 *----------------------------------------------------------------------
734752 *
10091027 }
10101028 return result;
10111029 }
1012
1030
10131031 /*
10141032 *----------------------------------------------------------------------
10151033 *
10941112 break;
10951113 }
10961114 }
1097
1115
10981116 /*
10991117 *----------------------------------------------------------------------
11001118 *
11911209 }
11921210 return (result == MATCHED);
11931211 }
1194
1212
11951213 /*
11961214 *----------------------------------------------------------------------
11971215 *
13081326
13091327 return UNMATCHED;
13101328 }
1311
1329
13121330 /*
13131331 *----------------------------------------------------------------------
13141332 *
13471365 DisposeDialog(aboutDlog);
13481366 SelectWindow(ActiveNonFloatingWindow());
13491367 }
1350
1368
13511369 /*
13521370 *----------------------------------------------------------------------
13531371 *
13841402 int defaultNativeButtonIndex; /* 1, 2, 3: right to left */
13851403 int typeIndex, i, indexDefaultOption = 0, result = TCL_ERROR;
13861404
1387 static const char *movableAlertStrings[] = {
1405 static const char *const movableAlertStrings[] = {
13881406 "-default", "-detail", "-icon", "-message", "-parent", "-title",
13891407 "-type", NULL
13901408 };
1391 static const char *movableTypeStrings[] = {
1409 static const char *const movableTypeStrings[] = {
13921410 "abortretryignore", "ok", "okcancel", "retrycancel", "yesno",
13931411 "yesnocancel", NULL
13941412 };
1395 static const char *movableButtonStrings[] = {
1413 static const char *const movableButtonStrings[] = {
13961414 "abort", "retry", "ignore", "ok", "cancel", "yes", "no", NULL
13971415 };
1398 static const char *movableIconStrings[] = {
1416 static const char *const movableIconStrings[] = {
13991417 "error", "info", "question", "warning", NULL
14001418 };
14011419 enum movableAlertOptions {
14821500
14831501 case ALERT_DETAIL:
14841502 str = Tcl_GetString(objv[i + 1]);
1503 if (finemessageTextCF) {
1504 CFRelease(finemessageTextCF);
1505 }
14851506 finemessageTextCF = CFStringCreateWithCString(NULL, str,
14861507 kCFStringEncodingUTF8);
14871508 break;
15091530
15101531 case ALERT_MESSAGE:
15111532 str = Tcl_GetString(objv[i + 1]);
1533 if (messageTextCF) {
1534 CFRelease(messageTextCF);
1535 }
15121536 messageTextCF = CFStringCreateWithCString(NULL, str,
15131537 kCFStringEncodingUTF8);
15141538 break;
15731597 * we do this here.
15741598 */
15751599
1576 str = Tcl_GetString(objv[indexDefaultOption + 1]);
15771600 if (Tcl_GetIndexFromObj(interp, objv[indexDefaultOption + 1],
15781601 movableButtonStrings, "value", TCL_EXACT, &defaultButtonIndex)
15791602 != TCL_OK) {
16701693 }
16711694 return result;
16721695 }
1673
1696
16741697 /*
16751698 *----------------------------------------------------------------------
16761699 *
17171740 }
17181741 return eventNotHandledErr;
17191742 }
1743
1744 /*
1745 *----------------------------------------------------------------------
1746 */
1747 #pragma mark [tk fontchooser] implementation (TIP 324)
1748 /*
1749 *----------------------------------------------------------------------
1750 */
1751
1752 #include "tkMacOSXEvent.h"
1753 #include "tkMacOSXFont.h"
1754
1755 typedef struct FontchooserData {
1756 Tcl_Obj *titleObj;
1757 Tcl_Obj *cmdObj;
1758 Tk_Window parent;
1759 } FontchooserData;
1760
1761 static Tcl_Obj *FontchooserCget(FontchooserData *fcdPtr, int optionIndex);
1762 static int FontchooserConfigureCmd(ClientData clientData, Tcl_Interp *interp,
1763 int objc, Tcl_Obj *const objv[]);
1764 static int FontchooserShowCmd(ClientData clientData, Tcl_Interp *interp,
1765 int objc, Tcl_Obj *const objv[]);
1766 static int FontchooserHideCmd(ClientData clientData, Tcl_Interp *interp,
1767 int objc, Tcl_Obj *const objv[]);
1768 static void FontchooserParentEventHandler(ClientData clientData,
1769 XEvent *eventPtr);
1770 static void DeleteFontchooserData(ClientData clientData, Tcl_Interp *interp);
1771
1772 MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[];
1773 const TkEnsemble tkFontchooserEnsemble[] = {
1774 { "configure", FontchooserConfigureCmd },
1775 { "show", FontchooserShowCmd },
1776 { "hide", FontchooserHideCmd },
1777 };
1778
1779 static Tcl_Interp *fontchooserInterp = NULL;
1780 static FMFontFamily fontPanelFontFamily = kInvalidFontFamily;
1781 static FMFontStyle fontPanelFontStyle = -1;
1782 static FMFontSize fontPanelFontSize = 0;
1783 static FMFont fontPanelFontID = kInvalidFont;
1784
1785 static const char *fontchooserOptionStrings[] = {
1786 "-parent", "-title", "-font", "-command",
1787 "-visible", NULL
1788 };
1789 enum FontchooserOption {
1790 FontchooserParent, FontchooserTitle, FontchooserFont, FontchooserCmd,
1791 FontchooserVisible
1792 };
1793
1794 /*
1795 *----------------------------------------------------------------------
1796 *
1797 * TkMacOSXProcessFontEvent --
1798 *
1799 * This processes events generated by user interaction with the
1800 * font panel.
1801 *
1802 * Results:
1803 * True if Tk events are generated - false otherwise.
1804 *
1805 * Side effects:
1806 * Additional events may be place on the Tk event queue.
1807 *
1808 *----------------------------------------------------------------------
1809 */
1810
1811 MODULE_SCOPE int
1812 TkMacOSXProcessFontEvent(
1813 TkMacOSXEvent * eventPtr,
1814 MacEventStatus * statusPtr)
1815 {
1816 OSStatus err;
1817 int eventGenerated = 0;
1818 FontchooserData *fcdPtr;
1819
1820 switch (eventPtr->eKind) {
1821 case kEventFontPanelClosed:
1822 case kEventFontSelection:
1823 break;
1824 default:
1825 goto done;
1826 }
1827 if (!fontchooserInterp) {
1828 goto done;
1829 }
1830 fcdPtr = Tcl_GetAssocData(fontchooserInterp, "::tk::fontchooser", NULL);
1831 switch (eventPtr->eKind) {
1832 case kEventFontPanelClosed:
1833 if (!FPIsFontPanelVisible() && fcdPtr->parent != None) {
1834 TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility");
1835 fontchooserInterp = NULL;
1836 eventGenerated = 1;
1837 }
1838 break;
1839 case kEventFontSelection: {
1840 Tcl_Obj *fontObj = NULL;
1841
1842 fontPanelFontFamily = kInvalidFontFamily;
1843 fontPanelFontStyle = -1;
1844 fontPanelFontSize = 0;
1845 fontPanelFontID = kInvalidFont;
1846 err = ChkErr(GetEventParameter, eventPtr->eventRef,
1847 kEventParamFMFontFamily, typeFMFontFamily, NULL,
1848 sizeof(FMFontFamily), NULL, &fontPanelFontFamily);
1849 err |= ChkErr(GetEventParameter, eventPtr->eventRef,
1850 kEventParamFMFontStyle, typeFMFontStyle, NULL,
1851 sizeof(FMFontStyle), NULL, &fontPanelFontStyle);
1852 err |= ChkErr(GetEventParameter, eventPtr->eventRef,
1853 kEventParamFMFontSize, typeFMFontSize, NULL,
1854 sizeof(FMFontSize), NULL, &fontPanelFontSize);
1855 if (err != noErr) {
1856 /*
1857 * No/incomplete QD font spec, use ATSUI font ID
1858 */
1859 Fixed fontFixedSize;
1860
1861 err = ChkErr(GetEventParameter, eventPtr->eventRef,
1862 kEventParamATSUFontID, typeATSUFontID, NULL,
1863 sizeof(ATSUFontID), NULL, &fontPanelFontID);
1864 if (err == noErr) {
1865 ChkErr(FMGetFontFamilyInstanceFromFont, fontPanelFontID,
1866 &fontPanelFontFamily, &fontPanelFontStyle);
1867 }
1868 err = ChkErr(GetEventParameter, eventPtr->eventRef,
1869 kEventParamATSUFontSize, typeATSUSize, NULL,
1870 sizeof(Fixed), NULL, &fontFixedSize);
1871 if (err == noErr) {
1872 fontPanelFontSize = FixedToInt(fontFixedSize);
1873 }
1874 }
1875 fontObj = TkMacOSXFontDescriptionForFMFontInfo(
1876 fontPanelFontFamily, fontPanelFontStyle,
1877 fontPanelFontSize, fontPanelFontID);
1878 if (fontObj) {
1879 if (fcdPtr->cmdObj) {
1880 int objc, result;
1881 Tcl_Obj **objv, **tmpv;
1882
1883 result = Tcl_ListObjGetElements(fontchooserInterp,
1884 fcdPtr->cmdObj, &objc, &objv);
1885 if (result == TCL_OK) {
1886 tmpv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) *
1887 (unsigned)(objc + 2));
1888 memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc);
1889 tmpv[objc] = fontObj;
1890 result = TkBackgroundEvalObjv(fontchooserInterp,
1891 objc + 1, tmpv, TCL_EVAL_GLOBAL);
1892 ckfree((char *)tmpv);
1893 }
1894 }
1895 TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged");
1896 }
1897 break;
1898 }
1899 }
1900 done:
1901 return eventGenerated;
1902 }
1903
1904 /*
1905 *----------------------------------------------------------------------
1906 *
1907 * FontchooserCget --
1908 *
1909 * Helper for the FontchooserConfigure command to return the
1910 * current value of any of the options (which may be NULL in
1911 * the structure)
1912 *
1913 * Results:
1914 * Tcl object of option value.
1915 *
1916 * Side effects:
1917 * None.
1918 *
1919 *----------------------------------------------------------------------
1920 */
1921
1922 static Tcl_Obj *
1923 FontchooserCget(
1924 FontchooserData *fcdPtr,
1925 int optionIndex)
1926 {
1927 Tcl_Obj *resObj = NULL;
1928
1929 switch(optionIndex) {
1930 case FontchooserParent: {
1931 if (fcdPtr->parent != None) {
1932 resObj = Tcl_NewStringObj(
1933 ((TkWindow*)fcdPtr->parent)->pathName, -1);
1934 } else {
1935 resObj = Tcl_NewStringObj(".", 1);
1936 }
1937 break;
1938 }
1939 case FontchooserTitle: {
1940 if (fcdPtr->titleObj) {
1941 resObj = fcdPtr->titleObj;
1942 } else {
1943 resObj = Tcl_NewObj();
1944 }
1945 break;
1946 }
1947 case FontchooserFont: {
1948 resObj = TkMacOSXFontDescriptionForFMFontInfo(
1949 fontPanelFontFamily, fontPanelFontStyle,
1950 fontPanelFontSize, fontPanelFontID);
1951 if (!resObj) {
1952 resObj = Tcl_NewObj();
1953 }
1954 break;
1955 }
1956 case FontchooserCmd: {
1957 if (fcdPtr->cmdObj) {
1958 resObj = fcdPtr->cmdObj;
1959 } else {
1960 resObj = Tcl_NewObj();
1961 }
1962 break;
1963 }
1964 case FontchooserVisible: {
1965 resObj = Tcl_NewBooleanObj(FPIsFontPanelVisible());
1966 break;
1967 }
1968 default: {
1969 resObj = Tcl_NewObj();
1970 }
1971 }
1972 return resObj;
1973 }
1974
1975 /*
1976 * ----------------------------------------------------------------------
1977 *
1978 * FontchooserConfigureCmd --
1979 *
1980 * Implementation of the 'tk fontchooser configure' ensemble command.
1981 * See the user documentation for what it does.
1982 *
1983 * Results:
1984 * See the user documentation.
1985 *
1986 * Side effects:
1987 * Per-interp data structure may be modified
1988 *
1989 * ----------------------------------------------------------------------
1990 */
1991
1992 static int
1993 FontchooserConfigureCmd(
1994 ClientData clientData, /* Main window */
1995 Tcl_Interp *interp,
1996 int objc,
1997 Tcl_Obj *const objv[])
1998 {
1999 Tk_Window tkwin = (Tk_Window)clientData;
2000 FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser",
2001 NULL);
2002 int i, r = TCL_OK;
2003
2004 /*
2005 * With no arguments we return all the options in a dict
2006 */
2007
2008 if (objc == 1) {
2009 Tcl_Obj *keyObj, *valueObj;
2010 Tcl_Obj *dictObj = Tcl_NewDictObj();
2011 for (i = 0; r == TCL_OK && fontchooserOptionStrings[i] != NULL; ++i) {
2012 keyObj = Tcl_NewStringObj(fontchooserOptionStrings[i], -1);
2013 valueObj = FontchooserCget(fcdPtr, i);
2014 r = Tcl_DictObjPut(interp, dictObj, keyObj, valueObj);
2015 }
2016 if (r == TCL_OK) {
2017 Tcl_SetObjResult(interp, dictObj);
2018 }
2019 return r;
2020 }
2021
2022 for (i = 1; i < objc; i += 2) {
2023 int optionIndex, len;
2024 if (Tcl_GetIndexFromObj(interp, objv[i], fontchooserOptionStrings,
2025 "option", 0, &optionIndex) != TCL_OK) {
2026 return TCL_ERROR;
2027 }
2028 if (objc == 2) {
2029 /* With one option and no arg, return the current value */
2030 Tcl_SetObjResult(interp, FontchooserCget(fcdPtr, optionIndex));
2031 return TCL_OK;
2032 }
2033 if (i + 1 == objc) {
2034 Tcl_AppendResult(interp, "value for \"",
2035 Tcl_GetString(objv[i]), "\" missing", NULL);
2036 return TCL_ERROR;
2037 }
2038 switch (optionIndex) {
2039 case FontchooserVisible: {
2040 const char *msg = "cannot change read-only option "
2041 "\"-visible\": use the show or hide command";
2042
2043 Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, sizeof(msg)-1));
2044 return TCL_ERROR;
2045 }
2046 case FontchooserParent: {
2047 Tk_Window parent = Tk_NameToWindow(interp,
2048 Tcl_GetString(objv[i+1]), tkwin);
2049 if (parent == None) {
2050 return TCL_ERROR;
2051 }
2052 if (fcdPtr->parent) {
2053 Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask,
2054 FontchooserParentEventHandler, fcdPtr);
2055 }
2056 fcdPtr->parent = parent;
2057 Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask,
2058 FontchooserParentEventHandler, fcdPtr);
2059 break;
2060 }
2061 case FontchooserTitle:
2062 if (fcdPtr->titleObj) {
2063 Tcl_DecrRefCount(fcdPtr->titleObj);
2064 }
2065 Tcl_GetStringFromObj(objv[i+1], &len);
2066 if (len) {
2067 fcdPtr->titleObj = objv[i+1];
2068 if (Tcl_IsShared(fcdPtr->titleObj)) {
2069 fcdPtr->titleObj = Tcl_DuplicateObj(fcdPtr->titleObj);
2070 }
2071 Tcl_IncrRefCount(fcdPtr->titleObj);
2072 } else {
2073 fcdPtr->titleObj = NULL;
2074 }
2075 break;
2076 case FontchooserFont: {
2077
2078 Tcl_GetStringFromObj(objv[i+1], &len);
2079 if (len) {
2080 Tk_Font f = Tk_AllocFontFromObj(interp, tkwin, objv[i+1]);
2081 if (f) {
2082 ATSUStyle atsuStyle;
2083
2084 TkMacOSXFMFontInfoForFont(f, &fontPanelFontFamily,
2085 &fontPanelFontStyle, &fontPanelFontSize,
2086 &atsuStyle);
2087 ChkErr(SetFontInfoForSelection,
2088 kFontSelectionATSUIType, 1, &atsuStyle, NULL);
2089 Tk_FreeFont(f);
2090 } else {
2091 return TCL_ERROR;
2092 }
2093 } else {
2094 fontPanelFontFamily = kInvalidFontFamily;
2095 ChkErr(SetFontInfoForSelection,
2096 kFontSelectionATSUIType, 0, NULL, NULL);
2097 }
2098 if (FPIsFontPanelVisible()) {
2099 TkSendVirtualEvent(fcdPtr->parent,
2100 "TkFontchooserFontChanged");
2101 }
2102 break;
2103 }
2104 case FontchooserCmd:
2105 if (fcdPtr->cmdObj) {
2106 Tcl_DecrRefCount(fcdPtr->cmdObj);
2107 }
2108 Tcl_GetStringFromObj(objv[i+1], &len);
2109 if (len) {
2110 fcdPtr->cmdObj = objv[i+1];
2111 if (Tcl_IsShared(fcdPtr->cmdObj)) {
2112 fcdPtr->cmdObj = Tcl_DuplicateObj(fcdPtr->cmdObj);
2113 }
2114 Tcl_IncrRefCount(fcdPtr->cmdObj);
2115 } else {
2116 fcdPtr->cmdObj = NULL;
2117 }
2118 break;
2119 }
2120 }
2121 return TCL_OK;
2122 }
2123
2124 /*
2125 * ----------------------------------------------------------------------
2126 *
2127 * FontchooserShowCmd --
2128 *
2129 * Implements the 'tk fontchooser show' ensemble command. The
2130 * per-interp configuration data for the dialog is held in an interp
2131 * associated structure.
2132 *
2133 * Results:
2134 * See the user documentation.
2135 *
2136 * Side effects:
2137 * Font Panel may be shown.
2138 *
2139 * ----------------------------------------------------------------------
2140 */
2141
2142 static int
2143 FontchooserShowCmd(
2144 ClientData clientData, /* Main window */
2145 Tcl_Interp *interp,
2146 int objc,
2147 Tcl_Obj *const objv[])
2148 {
2149 FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser",
2150 NULL);
2151
2152 if (fcdPtr->parent == None) {
2153 fcdPtr->parent = (Tk_Window) clientData;
2154 Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask,
2155 FontchooserParentEventHandler, fcdPtr);
2156 }
2157 if (!FPIsFontPanelVisible()) {
2158 ChkErr(FPShowHideFontPanel);
2159 TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility");
2160 }
2161 fontchooserInterp = interp;
2162
2163 return TCL_OK;
2164 }
2165
2166 /*
2167 * ----------------------------------------------------------------------
2168 *
2169 * FontchooserHideCmd --
2170 *
2171 * Implementation of the 'tk fontchooser hide' ensemble. See the
2172 * user documentation for details.
2173 *
2174 * Results:
2175 * See the user documentation.
2176 *
2177 * Side effects:
2178 * Font Panel may be hidden.
2179 *
2180 * ----------------------------------------------------------------------
2181 */
2182
2183 static int
2184 FontchooserHideCmd(
2185 ClientData clientData, /* Main window */
2186 Tcl_Interp *interp,
2187 int objc,
2188 Tcl_Obj *const objv[])
2189 {
2190 if (FPIsFontPanelVisible()) {
2191 ChkErr(FPShowHideFontPanel);
2192 }
2193 return TCL_OK;
2194 }
2195
2196 /*
2197 * ----------------------------------------------------------------------
2198 *
2199 * FontchooserParentEventHandler --
2200 *
2201 * Event handler for StructureNotify events on the font chooser's
2202 * parent window.
2203 *
2204 * Results:
2205 * None.
2206 *
2207 * Side effects:
2208 * Font chooser parent info is cleared and font panel is hidden.
2209 *
2210 * ----------------------------------------------------------------------
2211 */
2212
2213 static void
2214 FontchooserParentEventHandler(
2215 ClientData clientData,
2216 XEvent *eventPtr)
2217 {
2218 FontchooserData *fcdPtr = clientData;
2219
2220 if (eventPtr->type == DestroyNotify) {
2221 Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask,
2222 FontchooserParentEventHandler, fcdPtr);
2223 fcdPtr->parent = None;
2224 if (FPIsFontPanelVisible()) {
2225 ChkErr(FPShowHideFontPanel);
2226 }
2227 }
2228 }
2229
2230 /*
2231 * ----------------------------------------------------------------------
2232 *
2233 * DeleteFontchooserData --
2234 *
2235 * Clean up the font chooser configuration data when the interp
2236 * is destroyed.
2237 *
2238 * Results:
2239 * None.
2240 *
2241 * Side effects:
2242 * per-interp configuration data is destroyed.
2243 *
2244 * ----------------------------------------------------------------------
2245 */
2246
2247 static void
2248 DeleteFontchooserData(
2249 ClientData clientData,
2250 Tcl_Interp *interp)
2251 {
2252 FontchooserData *fcdPtr = clientData;
2253
2254 if (fcdPtr->titleObj) {
2255 Tcl_DecrRefCount(fcdPtr->titleObj);
2256 }
2257 if (fcdPtr->cmdObj) {
2258 Tcl_DecrRefCount(fcdPtr->cmdObj);
2259 }
2260 ckfree((char *)fcdPtr);
2261
2262 if (fontchooserInterp == interp) {
2263 fontchooserInterp = NULL;
2264 }
2265 }
2266
2267 /*
2268 * ----------------------------------------------------------------------
2269 *
2270 * TkInitFontchooser --
2271 *
2272 * Associate the font chooser configuration data with the Tcl
2273 * interpreter. There is one font chooser per interp.
2274 *
2275 * Results:
2276 * None.
2277 *
2278 * Side effects:
2279 * per-interp configuration data is destroyed.
2280 *
2281 * ----------------------------------------------------------------------
2282 */
2283
2284 MODULE_SCOPE int
2285 TkInitFontchooser(
2286 Tcl_Interp *interp,
2287 ClientData clientData)
2288 {
2289 FontchooserData *fcdPtr = (FontchooserData*)
2290 ckalloc(sizeof(FontchooserData));
2291
2292 bzero(fcdPtr, sizeof(FontchooserData));
2293 Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData,
2294 fcdPtr);
2295 return TCL_OK;
2296 }
2297
2298 /*
2299 * Local Variables:
2300 * mode: c
2301 * c-basic-offset: 4
2302 * fill-column: 79
2303 * coding: utf-8
2304 * End:
2305 */
1313 * See the file "license.terms" for information on usage and redistribution of
1414 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1515 *
16 * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.18 2008/06/19 00:14:10 das Exp $
16 * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.19 2008/10/20 10:50:20 dkf Exp $
1717 */
1818
1919 #include "tkMacOSXInt.h"
20 #include "tkBusy.h"
2021
2122 /*
2223 * One of the following structures exists for each container in this
11181119 ckfree((char *) containerPtr);
11191120 }
11201121 }
1122
1123 /*
1124 *----------------------------------------------------------------------
1125 *
1126 * TkpShowBusyWindow, TkpHideBusyWindow, TkpMakeTransparentWindowExist,
1127 * TkpCreateBusy --
1128 *
1129 * Portability layer for busy windows. Holds platform-specific gunk for
1130 * the [tk busy] command, which is currently a dummy implementation for
1131 * OSX/Aqua. The individual functions are supposed to do the following:
1132 *
1133 * TkpShowBusyWindow --
1134 * Make the busy window appear.
1135 *
1136 * TkpHideBusyWindow --
1137 * Make the busy window go away.
1138 *
1139 * TkpMakeTransparentWindowExist --
1140 * Actually make a transparent window.
1141 *
1142 * TkpCreateBusy --
1143 * Creates the platform-specific part of a busy window structure.
1144 *
1145 *----------------------------------------------------------------------
1146 */
1147
1148 void
1149 TkpShowBusyWindow(
1150 TkBusy busy)
1151 {
1152 }
1153
1154 void
1155 TkpHideBusyWindow(
1156 TkBusy busy)
1157 {
1158 }
1159
1160 void
1161 TkpMakeTransparentWindowExist(
1162 Tk_Window tkwin, /* Token for window. */
1163 Window parent) /* Parent window. */
1164 {
1165 }
1166
1167 void
1168 TkpCreateBusy(
1169 Tk_FakeWin *winPtr,
1170 Tk_Window tkRef,
1171 Window* parentPtr,
1172 Tk_Window tkParent,
1173 TkBusy busy)
1174 {
1175 }
1176
1177 /*
1178 * Local Variables:
1179 * mode: c
1180 * c-basic-offset: 4
1181 * fill-column: 78
1182 * End:
1183 */
5252 * software in accordance with the terms specified in this
5353 * license.
5454 *
55 * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.14 2007/12/13 15:27:09 dgp Exp $
55 * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.15 2008/11/08 18:44:40 dkf Exp $
5656 */
5757
5858 #include "tkMacOSXPrivate.h"
5959 #include "tkMacOSXDefault.h"
6060 #include "tkEntry.h"
6161
62 static ThemeButtonKind ComputeIncDecParameters (int height, int *width);
63
62 static ThemeButtonKind ComputeIncDecParameters(int height, int *width);
63
6464 /*
6565 *--------------------------------------------------------------
6666 *
6767 * ComputeIncDecParameters --
6868 *
69 * This procedure figures out which of the kThemeIncDec
70 * buttons to use. It also sets width to the width of the
71 * IncDec button.
69 * This procedure figures out which of the kThemeIncDec buttons to use.
70 * It also sets width to the width of the IncDec button.
7271 *
7372 * Results:
7473 * The ThemeButtonKind of the button we should use.
7877 *
7978 *--------------------------------------------------------------
8079 */
80
8181 static ThemeButtonKind
82 ComputeIncDecParameters(int height, int *width)
82 ComputeIncDecParameters(
83 int height,
84 int *width)
8385 {
8486 ThemeButtonKind kind;
8587
111113
112114 return kind;
113115 }
114
116
115117 /*
116118 *--------------------------------------------------------------
117119 *
118120 * TkpDrawEntryBorderAndFocus --
119121 *
120 * This procedure redraws the border of an entry window.
121 * It overrides the generic border drawing code if the
122 * entry widget parameters are such that the native widget
123 * drawing is a good fit.
124 * This version just returns 1, so platforms that don't
125 * do special native drawing don't have to implement it.
122 * This procedure redraws the border of an entry window. It overrides the
123 * generic border drawing code if the entry widget parameters are such
124 * that the native widget drawing is a good fit. This version just
125 * returns 1, so platforms that don't do special native drawing don't
126 * have to implement it.
126127 *
127128 * Results:
128129 * 1 if it has drawn the border, 0 if not.
132133 *
133134 *--------------------------------------------------------------
134135 */
136
135137 int
136 TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox)
138 TkpDrawEntryBorderAndFocus(
139 Entry *entryPtr,
140 Drawable d,
141 int isSpinbox)
137142 {
138143 Rect bounds;
139144 TkMacOSXDrawingContext dc;
144149 MacDrawable *macDraw = (MacDrawable *) d;
145150
146151 /*
147 * I use 6 as the borderwidth. 2 of the 5 go into the actual frame the
148 * 3 are because the Mac OS Entry widgets leave more space around the
149 * Text than Tk does on X11.
152 * I use 6 as the borderwidth. 2 of the 5 go into the actual frame the 3
153 * are because the Mac OS Entry widgets leave more space around the Text
154 * than Tk does on X11.
150155 */
151156
152157 if (entryPtr->borderWidth != MAC_OSX_ENTRY_BORDER
156161 }
157162
158163 /*
159 * For the spinbox, we have to make the entry part smaller by the size
160 * of the buttons. We also leave 2 pixels to the left (as per the HIG)
161 * and space for one pixel to the right, 'cause it makes the buttons look
164 * For the spinbox, we have to make the entry part smaller by the size of
165 * the buttons. We also leave 2 pixels to the left (as per the HIG) and
166 * space for one pixel to the right, 'cause it makes the buttons look
162167 * nicer.
163168 */
164169
174179 }
175180
176181 /*
177 * The focus ring is drawn with an Alpha at the outside
178 * part of the ring, so we have to draw over the edges of the
179 * ring before drawing the focus or the text will peep through.
182 * The focus ring is drawn with an Alpha at the outside part of the ring,
183 * so we have to draw over the edges of the ring before drawing the focus
184 * or the text will peep through.
180185 */
181186
182187 bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, d);
183188 TkDrawInsetFocusHighlight(entryPtr->tkwin, bgGC, MAC_OSX_FOCUS_WIDTH, d, 0);
184189
185190 /*
186 * Inset the entry Frame by the maximum width of the focus rect,
187 * which is 3 according to the Carbon docs.
191 * Inset the entry Frame by the maximum width of the focus rect, which is
192 * 3 according to the Carbon docs.
188193 */
189194
190195 bounds.left = macDraw->xOff + MAC_OSX_FOCUS_WIDTH;
202207 DrawThemeEditTextFrame(&bounds, drawState);
203208 if (entryPtr->flags & GOT_FOCUS) {
204209 /*
205 * Don't call this if we don't have the focus, because then it
206 * erases the focus rect to white, but we've already drawn the
210 * Don't call this if we don't have the focus, because then it erases
211 * the focus rect to white, but we've already drawn the
207212 * highlightbackground above.
208213 */
209214
215220 TkMacOSXRestoreDrawingContext(&dc);
216221 return 1;
217222 }
223
218224 /*
219225 *--------------------------------------------------------------
220226 *
221227 * TkpDrawSpinboxButtons --
222228 *
223 * This procedure redraws the buttons of an spinbox widget.
224 * It overrides the generic button drawing code if the
225 * spinbox widget parameters are such that the native widget
226 * drawing is a good fit.
227 * This version just returns 0, so platforms that don't
228 * do special native drawing don't have to implement it.
229 * This procedure redraws the buttons of an spinbox widget. It overrides
230 * the generic button drawing code if the spinbox widget parameters are
231 * such that the native widget drawing is a good fit. This version just
232 * returns 0, so platforms that don't do special native drawing don't
233 * have to implement it.
229234 *
230235 * Results:
231236 * 1 if it has drawn the border, 0 if not.
237242 */
238243
239244 int
240 TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d)
245 TkpDrawSpinboxButtons(
246 Spinbox *sbPtr,
247 Drawable d)
241248 {
242249 Rect inBounds;
243250 ThemeButtonKind inKind;
264271 }
265272
266273 /*
267 * The actual sizes of the IncDec button are 21 for the normal,
268 * 18 for the small and 15 for the mini. But the spinbox still
269 * looks okay if the entry is a little bigger than this, so we
270 * give it a little slop.
274 * The actual sizes of the IncDec button are 21 for the normal, 18 for the
275 * small and 15 for the mini. But the spinbox still looks okay if the
276 * entry is a little bigger than this, so we give it a little slop.
271277 */
272278
273279 inKind = ComputeIncDecParameters(buttonHeight, &incDecWidth);
296302 inBounds.top = macDraw->yOff + MAC_OSX_FOCUS_WIDTH;
297303 inBounds.bottom = macDraw->yOff + Tk_Height(tkwin) - MAC_OSX_FOCUS_WIDTH;
298304
299 /* We had to make the entry part of the window smaller so that we
300 * wouldn't overdraw the spin buttons with the focus highlight. So
301 * now we have to draw the highlightbackground.
305 /*
306 * We had to make the entry part of the window smaller so that we wouldn't
307 * overdraw the spin buttons with the focus highlight. So now we have to
308 * draw the highlightbackground.
302309 */
303310
304311 bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d);
316323 TkMacOSXRestoreDrawingContext(&dc);
317324 return 1;
318325 }
319
99 * See the file "license.terms" for information on usage and redistribution
1010 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.23 2007/12/13 15:27:09 dgp Exp $
12 * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.25 2008/12/10 05:02:52 das Exp $
1313 */
1414
1515 #include "tkMacOSXPrivate.h"
1616 #include "tkMacOSXEvent.h"
1717 #include "tkMacOSXDebug.h"
18
1918
2019 /*
2120 *----------------------------------------------------------------------
2221 *
2322 * TkMacOSXFlushWindows --
2423 *
25 * This routine flushes all the Carbon windows of the application. It
26 * is called by XSync().
24 * This routine flushes all the Carbon windows of the application. It is
25 * called by XSync().
2726 *
2827 * Results:
2928 * None.
6160 * This dispatches a filtered Carbon event to the appropriate handler
6261 *
6362 * Note on MacEventStatus.stopProcessing: Please be conservative in the
64 * individual handlers and don't assume the event is fully handled
65 * unless you *really* need to ensure that other handlers don't see the
66 * event anymore. Some OS manager or library might be interested in
67 * events even after they are already handled on the Tk level.
63 * individual handlers and don't assume the event is fully handled unless
64 * you *really* need to ensure that other handlers don't see the event
65 * anymore. Some OS manager or library might be interested in events even
66 * after they are already handled on the Tk level.
6867 *
6968 * Results:
7069 * 0 on success
8281 MacEventStatus *statusPtr)
8382 {
8483 switch (eventPtr->eClass) {
85 case kEventClassMouse:
86 TkMacOSXProcessMouseEvent(eventPtr, statusPtr);
87 break;
88 case kEventClassWindow:
89 TkMacOSXProcessWindowEvent(eventPtr, statusPtr);
90 break;
91 case kEventClassKeyboard:
92 TkMacOSXProcessKeyboardEvent(eventPtr, statusPtr);
93 break;
94 case kEventClassApplication:
95 TkMacOSXProcessApplicationEvent(eventPtr, statusPtr);
96 break;
97 case kEventClassAppearance:
98 TkMacOSXProcessAppearanceEvent(eventPtr, statusPtr);
99 break;
100 case kEventClassMenu:
101 TkMacOSXProcessMenuEvent(eventPtr, statusPtr);
102 break;
103 case kEventClassCommand:
104 TkMacOSXProcessCommandEvent(eventPtr, statusPtr);
105 break;
106 default: {
107 TkMacOSXDbgMsg("Unrecognised event: %s",
108 TkMacOSXCarbonEventToAscii(eventPtr->eventRef));
109 break;
110 }
84 case kEventClassMouse:
85 TkMacOSXProcessMouseEvent(eventPtr, statusPtr);
86 break;
87 case kEventClassWindow:
88 TkMacOSXProcessWindowEvent(eventPtr, statusPtr);
89 break;
90 case kEventClassKeyboard:
91 TkMacOSXProcessKeyboardEvent(eventPtr, statusPtr);
92 break;
93 case kEventClassApplication:
94 TkMacOSXProcessApplicationEvent(eventPtr, statusPtr);
95 break;
96 case kEventClassAppearance:
97 TkMacOSXProcessAppearanceEvent(eventPtr, statusPtr);
98 break;
99 case kEventClassMenu:
100 TkMacOSXProcessMenuEvent(eventPtr, statusPtr);
101 break;
102 case kEventClassCommand:
103 TkMacOSXProcessCommandEvent(eventPtr, statusPtr);
104 break;
105 case kEventClassFont:
106 TkMacOSXProcessFontEvent(eventPtr, statusPtr);
107 break;
108 default: {
109 TkMacOSXDbgMsg("Unrecognised event: %s",
110 TkMacOSXCarbonEventToAscii(eventPtr->eventRef));
111 break;
112 }
111113 }
112114 return 0;
113115 }
117119 *
118120 * TkMacOSXProcessMenuEvent --
119121 *
120 * This routine processes the event in eventPtr, and
121 * generates the appropriate Tk events from it.
122 * This routine processes the event in eventPtr, and generates the
123 * appropriate Tk events from it.
122124 *
123125 * Results:
124126 * True if event(s) are generated - false otherwise.
136138 {
137139 int menuContext;
138140 OSStatus err;
141 MenuRef menu;
142 MenuItemIndex index;
139143
140144 switch (eventPtr->eKind) {
145 case kEventMenuBeginTracking:
146 case kEventMenuEndTracking:
147 case kEventMenuOpening:
148 case kEventMenuTargetItem:
149 break;
150 default:
151 return 0;
152 }
153 err = ChkErr(GetEventParameter, eventPtr->eventRef,
154 kEventParamMenuContext, typeUInt32, NULL, sizeof(menuContext),
155 NULL, &menuContext);
156 if (err != noErr) {
157 return 0;
158 }
159
160 if ((menuContext & kMenuContextMenuBarTracking) ||
161 (menuContext & kMenuContextPopUpTracking)) {
162 switch (eventPtr->eKind) {
141163 case kEventMenuBeginTracking:
164 TkMacOSXClearMenubarActive();
165
166 /*
167 * Handle -postcommand
168 */
169
170 TkMacOSXPreprocessMenu();
171 TkMacOSXTrackingLoop(1);
172 break;
142173 case kEventMenuEndTracking:
174 TkMacOSXTrackingLoop(0);
175 break;
143176 case kEventMenuOpening:
177 err = ChkErr(GetEventParameter, eventPtr->eventRef,
178 kEventParamDirectObject, typeMenuRef, NULL, sizeof(menu),
179 NULL, &menu);
180 if (err != noErr) {
181 return 0;
182 }
183 TkMacOSXClearActiveMenu(menu);
184 return TkMacOSXGenerateParentMenuSelectEvent(menu);
144185 case kEventMenuTargetItem:
145 break;
146 default:
147 return 0;
148 break;
149 }
150 err = ChkErr(GetEventParameter, eventPtr->eventRef, kEventParamMenuContext,
151 typeUInt32, NULL, sizeof(menuContext), NULL, &menuContext);
152 if (err == noErr && ((menuContext & kMenuContextMenuBarTracking) ||
153 (menuContext & kMenuContextPopUpTracking))) {
154 switch (eventPtr->eKind) {
155 MenuRef menu;
156
157 case kEventMenuBeginTracking:
158 TkMacOSXClearMenubarActive();
159
160 /*
161 * Handle -postcommand
162 */
163
164 TkMacOSXPreprocessMenu();
165 TkMacOSXTrackingLoop(1);
166 break;
167 case kEventMenuEndTracking:
168 TkMacOSXTrackingLoop(0);
169 break;
170 case kEventMenuOpening:
171 err = ChkErr(GetEventParameter, eventPtr->eventRef,
172 kEventParamDirectObject, typeMenuRef, NULL,
173 sizeof(menu), NULL, &menu);
174 if (err == noErr) {
175 TkMacOSXClearActiveMenu(menu);
176 return TkMacOSXGenerateParentMenuSelectEvent(menu);
177 }
178 break;
179 case kEventMenuTargetItem:
180 err = ChkErr(GetEventParameter, eventPtr->eventRef,
181 kEventParamDirectObject, typeMenuRef, NULL,
182 sizeof(menu), NULL, &menu);
183 if (err == noErr) {
184 MenuItemIndex index;
185
186 err = ChkErr(GetEventParameter, eventPtr->eventRef,
187 kEventParamMenuItemIndex, typeMenuItemIndex, NULL,
188 sizeof(index), NULL, &index);
189 if (err == noErr) {
190 return TkMacOSXGenerateMenuSelectEvent(menu, index);
191 }
192 }
193 break;
186 err = ChkErr(GetEventParameter, eventPtr->eventRef,
187 kEventParamDirectObject, typeMenuRef, NULL, sizeof(menu),
188 NULL, &menu);
189 if (err != noErr) {
190 return 0;
191 }
192
193 err = ChkErr(GetEventParameter, eventPtr->eventRef,
194 kEventParamMenuItemIndex, typeMenuItemIndex, NULL,
195 sizeof(index), NULL, &index);
196 if (err != noErr) {
197 return 0;
198 }
199 return TkMacOSXGenerateMenuSelectEvent(menu, index);
194200 }
195201 }
196202 return 0;
201207 *
202208 * TkMacOSXProcessCommandEvent --
203209 *
204 * This routine processes the event in eventPtr, and
205 * generates the appropriate Tk events from it.
210 * This routine processes the event in eventPtr, and generates the
211 * appropriate Tk events from it.
206212 *
207213 * Results:
208214 * True if event(s) are generated - false otherwise.
216222 MODULE_SCOPE int
217223 TkMacOSXProcessCommandEvent(
218224 TkMacOSXEvent *eventPtr,
219 MacEventStatus * statusPtr)
225 MacEventStatus *statusPtr)
220226 {
221227 HICommand command;
222228 int menuContext;
223229 OSStatus err;
224230
225231 switch (eventPtr->eKind) {
226 case kEventCommandProcess:
227 case kEventCommandUpdateStatus:
228 break;
229 default:
230 return 0;
231 break;
232 }
232 case kEventCommandProcess:
233 case kEventCommandUpdateStatus:
234 break;
235 default:
236 return 0;
237 }
238
233239 err = ChkErr(GetEventParameter, eventPtr->eventRef,
234240 kEventParamDirectObject, typeHICommand, NULL, sizeof(command),
235241 NULL, &command);
236 if (err == noErr && (command.attributes & kHICommandFromMenu)) {
242 if (err != noErr) {
243 return 0;
244 }
245
246 if (command.attributes & kHICommandFromMenu) {
237247 if (eventPtr->eKind == kEventCommandProcess) {
238248 err = ChkErr(GetEventParameter, eventPtr->eventRef,
239249 kEventParamMenuContext, typeUInt32, NULL,
240250 sizeof(menuContext), NULL, &menuContext);
241 if (err == noErr && (menuContext & kMenuContextMenuBar) &&
251 if (err != noErr) {
252 return 0;
253 }
254
255 if ((menuContext & kMenuContextMenuBar) &&
242256 (menuContext & kMenuContextMenuBarTracking)) {
243257 TkMacOSXHandleMenuSelect(GetMenuID(command.menu.menuRef),
244258 command.menu.menuItemIndex,
247261 }
248262 } else {
249263 Tcl_CmdInfo dummy;
250 if (command.commandID == kHICommandPreferences && eventPtr->interp) {
264
265 if (command.commandID == kHICommandPreferences
266 && eventPtr->interp != NULL) {
251267 if (Tcl_GetCommandInfo(eventPtr->interp,
252268 "::tk::mac::ShowPreferences", &dummy)) {
253269 if (!IsMenuItemEnabled(command.menu.menuRef,
269285 }
270286 return 0;
271287 }
288
289 /*
290 * Local Variables:
291 * mode: c
292 * c-basic-offset: 4
293 * fill-column: 78
294 * End:
295 */
5353 * software in accordance with the terms specified in this
5454 * license.
5555 *
56 * RCS: @(#) $Id: tkMacOSXEvent.h,v 1.12 2007/04/23 21:24:33 das Exp $
56 * RCS: @(#) $Id: tkMacOSXEvent.h,v 1.13 2008/12/10 05:02:52 das Exp $
5757 */
5858
5959 #ifndef _TKMACEVENT
9797 MacEventStatus *statusPtr);
9898 MODULE_SCOPE int TkMacOSXProcessCommandEvent(TkMacOSXEvent *e,
9999 MacEventStatus *statusPtr);
100 MODULE_SCOPE int TkMacOSXProcessFontEvent(TkMacOSXEvent *e,
101 MacEventStatus *statusPtr);
100102 MODULE_SCOPE int TkMacOSXKeycodeToUnicode(
101103 UniChar * uniChars, int maxChars,
102104 EventKind eKind,
3434 * that such fonts can not be used for controls, because controls
3535 * definitely require a family id (this assertion needs testing).
3636 *
37 * RCS: @(#) $Id: tkMacOSXFont.c,v 1.39 2008/08/19 00:17:44 das Exp $
37 * RCS: @(#) $Id: tkMacOSXFont.c,v 1.43 2008/12/10 05:02:52 das Exp $
3838 */
3939
4040 #include "tkMacOSXPrivate.h"
261261 static void InitSystemFonts(TkMainInfo *mainPtr);
262262 static int CreateNamedSystemFont(Tcl_Interp *interp, Tk_Window tkwin,
263263 const char* name, TkFontAttributes *faPtr);
264
264 static void DrawCharsInContext(Display *display,
265 Drawable drawable, GC gc, Tk_Font tkfont,
266 const char *source, int numBytes, int rangeStart,
267 int rangeLength, int x, int y, double angle);
265268
266269 /*
267270 *-------------------------------------------------------------------------
11341137 int x, int y) /* Coordinates at which to place origin of the
11351138 * string when drawing. */
11361139 {
1137 TkpDrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
1138 0, numBytes, x, y);
1140 DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
1141 0, numBytes, x, y, 0.0);
1142 }
1143
1144 void
1145 TkpDrawAngledChars(
1146 Display *display, /* Display on which to draw. */
1147 Drawable drawable, /* Window or pixmap in which to draw. */
1148 GC gc, /* Graphics context for drawing characters. */
1149 Tk_Font tkfont, /* Font in which characters will be drawn;
1150 * must be the same as font used in GC. */
1151 const char *source, /* UTF-8 string to be displayed. Need not be
1152 * '\0' terminated. All Tk meta-characters
1153 * (tabs, control characters, and newlines)
1154 * should be stripped out of the string that
1155 * is passed to this function. If they are not
1156 * stripped out, they will be displayed as
1157 * regular printing characters. */
1158 int numBytes, /* Number of bytes in string. */
1159 double x, double y, /* Coordinates at which to place origin of
1160 * string when drawing. */
1161 double angle) /* What angle to put text at, in degrees. */
1162 {
1163 DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
1164 0, numBytes, x, y, angle);
11391165 }
11401166
11411167 /*
11791205 * whole (not just the range) string when
11801206 * drawing. */
11811207 {
1208 DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
1209 rangeStart, rangeLength, x, y, 0.0);
1210 }
1211
1212 static void
1213 DrawCharsInContext(
1214 Display *display, /* Display on which to draw. */
1215 Drawable drawable, /* Window or pixmap in which to draw. */
1216 GC gc, /* Graphics context for drawing characters. */
1217 Tk_Font tkfont, /* Font in which characters will be drawn; must
1218 * be the same as font used in GC. */
1219 const char * source, /* UTF-8 string to be displayed. Need not be
1220 * '\0' terminated. All Tk meta-characters
1221 * (tabs, control characters, and newlines)
1222 * should be stripped out of the string that
1223 * is passed to this function. If they are not
1224 * stripped out, they will be displayed as
1225 * regular printing characters. */
1226 int numBytes, /* Number of bytes in string. */
1227 int rangeStart, /* Index of first byte to draw. */
1228 int rangeLength, /* Length of range to draw in bytes. */
1229 int x, int y, /* Coordinates at which to place origin of the
1230 * whole (not just the range) string when
1231 * drawing. */
1232 double angle)
1233 {
11821234 const MacFont * fontPtr = (const MacFont *) tkfont;
11831235 MacDrawable *macWin = (MacDrawable *) drawable;
11841236 Fixed fx, fy;
12401292
12411293 urstart = Tcl_NumUtfChars(source, rangeStart);
12421294 urlen = Tcl_NumUtfChars(source+rangeStart,rangeLength);
1295
1296 /*
1297 * Rotate the coordinate system for Quarz drawing.
1298 */
1299
1300 if (drawingContext.context && angle != 0.0) {
1301 CGContextConcatCTM(drawingContext.context, CGAffineTransformTranslate(
1302 CGAffineTransformRotate(CGAffineTransformMakeTranslation(
1303 x, y), angle * PI/180.0), -x, -y));
1304 }
12431305
12441306 ChkErr(ATSUDrawText, fontPtr->atsuLayout, lineOffset+urstart, urlen, fx,
12451307 fy);
19291991 const char *name) /* Name or alias name of the font to find. */
19301992 {
19311993 const MacFontFamily * familyPtr;
1932 char ** aliases;
1994 const char *const * aliases;
19331995 int i;
19341996
19351997 familyPtr = FindFontFamily(name);
19552017 {
19562018 const MacFontFamily * familyPtr;
19572019 const char * fallback;
1958 char *** fallbacks;
2020 const char *const *const * fallbacks;
19592021 int i, j;
19602022
19612023 familyPtr = FindFontFamilyOrAlias(name);
24542516 /*
24552517 *----------------------------------------------------------------------
24562518 *
2519 * TkMacOSXFMFontInfoForFont --
2520 *
2521 * Retrieve FontManager/ATSUI font information for a Tk font.
2522 *
2523 * Results:
2524 * None.
2525 *
2526 * Side effects:
2527 * None.
2528 *
2529 *----------------------------------------------------------------------
2530 */
2531
2532 MODULE_SCOPE void
2533 TkMacOSXFMFontInfoForFont(
2534 Tk_Font tkfont,
2535 FMFontFamily *fontFamilyPtr,
2536 FMFontStyle *fontStylePtr,
2537 FMFontSize *fontSizePtr,
2538 ATSUStyle *fontATSUStylePtr)
2539 {
2540 const MacFont * fontPtr = (MacFont *) tkfont;
2541
2542 if (fontFamilyPtr) {
2543 *fontFamilyPtr = fontPtr->qdFont;
2544 }
2545 if (fontStylePtr) {
2546 *fontStylePtr = fontPtr->qdStyle;
2547 }
2548 if (fontSizePtr) {
2549 *fontSizePtr = fontPtr->qdSize;
2550 }
2551 if (fontATSUStylePtr) {
2552 *fontATSUStylePtr = fontPtr->atsuStyle;
2553 }
2554 }
2555
2556 /*
2557 *----------------------------------------------------------------------
2558 *
2559 * TkMacOSXFontDescriptionForFMFontInfo --
2560 *
2561 * Get text description of a font specified by FontManager info.
2562 *
2563 * Results:
2564 * List object or NULL.
2565 *
2566 * Side effects:
2567 * None.
2568 *
2569 *----------------------------------------------------------------------
2570 */
2571
2572 MODULE_SCOPE Tcl_Obj *
2573 TkMacOSXFontDescriptionForFMFontInfo(
2574 FMFontFamily fontFamily,
2575 FMFontStyle fontStyle,
2576 FMFontSize fontSize,
2577 FMFont fontID)
2578 {
2579 Tcl_Obj *objv[6];
2580 int i = 0;
2581
2582 if (fontFamily != kInvalidFontFamily && fontStyle != -1) {
2583 const char *familyName = FamilyNameForFamilyID(fontFamily);
2584
2585 if (familyName) {
2586 objv[i++] = Tcl_NewStringObj(familyName, -1);
2587 objv[i++] = Tcl_NewIntObj(fontSize);
2588 #define S(s) Tcl_NewStringObj(STRINGIFY(s),(int)(sizeof(STRINGIFY(s))-1))
2589 objv[i++] = (fontStyle & bold) ? S(bold) : S(normal);
2590 objv[i++] = (fontStyle & italic) ? S(italic) : S(roman);
2591 if (fontStyle & underline) objv[i++] = S(underline);
2592 /*if (fontStyle & overstrike) objv[i++] = S(overstrike);*/
2593 #undef S
2594 }
2595 } else if (fontID != kInvalidFont) {
2596 CFStringRef fontName = NULL;
2597 Tcl_Obj *fontNameObj = NULL;
2598
2599 ChkErr(ATSFontGetName, FMGetATSFontRefFromFont(fontID),
2600 kATSOptionFlagsDefault, &fontName);
2601 if (fontName) {
2602 fontNameObj = TkMacOSXGetStringObjFromCFString(fontName);
2603 CFRelease(fontName);
2604 }
2605 if (fontNameObj) {
2606 objv[i++] = fontNameObj;
2607 objv[i++] = Tcl_NewIntObj(fontSize);
2608 }
2609 }
2610 return i ? Tcl_NewListObj(i, objv) : NULL;
2611 }
2612
2613 /*
2614 *----------------------------------------------------------------------
2615 *
24572616 * TkMacOSXUseAntialiasedText --
24582617 *
24592618 * Enables or disables application-wide use of antialiased text (where
1111 * See the file "license.terms" for information on usage and redistribution
1212 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkMacOSXFont.h,v 1.5 2007/04/23 21:24:33 das Exp $
14 * RCS: @(#) $Id: tkMacOSXFont.h,v 1.6 2008/12/10 05:02:52 das Exp $
1515 */
1616
1717 #ifndef TKMACOSXFONT_H
2929
3030 MODULE_SCOPE void TkMacOSXInitControlFontStyle(Tk_Font tkfont,
3131 ControlFontStylePtr fsPtr);
32 MODULE_SCOPE void TkMacOSXFMFontInfoForFont(Tk_Font tkfont,
33 FMFontFamily *fontFamilyPtr, FMFontStyle *fontStylePtr,
34 FMFontSize *fontSizePtr, ATSUStyle *fontATSUStylePtr);
35 MODULE_SCOPE Tcl_Obj * TkMacOSXFontDescriptionForFMFontInfo(
36 FMFontFamily fontFamily, FMFontStyle fontStyle, FMFontSize fontSize,
37 FMFont fontID);
3238
3339 #endif /*TKMACOSXFONT_H*/
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.18 2008/09/02 16:10:55 das Exp $
13 * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.19 2008/12/09 21:22:56 dgp Exp $
1414 */
1515
1616 #include "tkMacOSXPrivate.h"
207207
208208 if (interp &&
209209 Tcl_GetCommandInfo(interp, "::tk::mac::OpenApplication", &dummy)){
210 if (Tcl_GlobalEval(interp, "::tk::mac::OpenApplication") != TCL_OK) {
211 Tcl_BackgroundError(interp);
210 int code = Tcl_GlobalEval(interp, "::tk::mac::OpenApplication");
211 if (code != TCL_OK) {
212 Tcl_BackgroundException(interp, code);
212213 }
213214 }
214215 return noErr;
243244
244245 if (interp && Tcl_GetCommandInfo(interp,
245246 "::tk::mac::ReopenApplication", &dummy)) {
246 if (Tcl_GlobalEval(interp, "::tk::mac::ReopenApplication") != TCL_OK){
247 Tcl_BackgroundError(interp);
247 int code = Tcl_GlobalEval(interp, "::tk::mac::ReopenApplication");
248 if (code != TCL_OK){
249 Tcl_BackgroundException(interp, code);
248250 }
249251 }
250252 return err;
278280
279281 if (interp &&
280282 Tcl_GetCommandInfo(interp, "::tk::mac::ShowPreferences", &dummy)){
281 if (Tcl_GlobalEval(interp, "::tk::mac::ShowPreferences") != TCL_OK) {
282 Tcl_BackgroundError(interp);
283 int code = Tcl_GlobalEval(interp, "::tk::mac::ShowPreferences");
284 if (code != TCL_OK) {
285 Tcl_BackgroundException(interp, code);
283286 }
284287 }
285288 return noErr;
316319 AEKeyword keyword;
317320 Tcl_DString command, pathName;
318321 Tcl_CmdInfo dummy;
322 int code;
319323
320324 /*
321325 * Don't bother if we don't have an interp or the open document procedure
366370 * Now handle the event by evaluating a script.
367371 */
368372
369 if (Tcl_EvalEx(interp, Tcl_DStringValue(&command),
370 Tcl_DStringLength(&command), TCL_EVAL_GLOBAL) != TCL_OK) {
371 Tcl_BackgroundError(interp);
373 code = Tcl_EvalEx(interp, Tcl_DStringValue(&command),
374 Tcl_DStringLength(&command), TCL_EVAL_GLOBAL);
375 if (code != TCL_OK) {
376 Tcl_BackgroundException(interp, code);
372377 }
373378 Tcl_DStringFree(&command);
374379 return noErr;
405410 AEKeyword keyword;
406411 Tcl_DString command, pathName;
407412 Tcl_CmdInfo dummy;
413 int code;
408414
409415 /*
410416 * Don't bother if we don't have an interp or the print document procedure
450456 * Now handle the event by evaluating a script.
451457 */
452458
453 if (Tcl_EvalEx(interp, Tcl_DStringValue(&command),
454 Tcl_DStringLength(&command), TCL_EVAL_GLOBAL) != TCL_OK) {
455 Tcl_BackgroundError(interp);
459 code = Tcl_EvalEx(interp, Tcl_DStringValue(&command),
460 Tcl_DStringLength(&command), TCL_EVAL_GLOBAL);
461 if (code != TCL_OK) {
462 Tcl_BackgroundException(interp, code);
456463 }
457464 Tcl_DStringFree(&command);
458465 return noErr;
619626 Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp;
620627 Tcl_CmdInfo dummy;
621628 int quit = Tcl_GetCommandInfo(interp, "::tk::mac::Quit", &dummy);
622
623 if (Tcl_GlobalEval(interp, quit ? "::tk::mac::Quit" : "exit") != TCL_OK) {
629 int code = Tcl_GlobalEval(interp, quit ? "::tk::mac::Quit" : "exit");
630
631 if (code != TCL_OK) {
624632 /*
625633 * Should be never reached...
626634 */
627635
628 Tcl_BackgroundError(interp);
636 Tcl_BackgroundException(interp, code);
629637 }
630638 return 1;
631639 }
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkMacOSXInit.c,v 1.36 2008/06/19 00:13:02 das Exp $
13 * RCS: @(#) $Id: tkMacOSXInit.c,v 1.38 2008/12/15 16:17:18 dgp Exp $
1414 */
1515
1616 #include "tkMacOSXPrivate.h"
17
18 #include "tclInt.h" /* for Tcl_GetStartupScript() & Tcl_SetStartupScript() */
1917
2018 #include <sys/stat.h>
2119 #include <sys/utsname.h>
133131 int i;
134132 struct utsname name;
135133 long osVersion = 0;
134 struct stat st;
136135
137136 initialized = 1;
138137
349348 * clicking Wish) then use the Tk based console interpreter.
350349 */
351350
352 if (!isatty(0)) {
353 struct stat st;
354
355 if (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)) {
356 Tk_InitConsoleChannels(interp);
357 Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
358 Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
359 Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
360
361 /*
362 * Only show the console if we don't have a startup script
363 * and tcl_interactive hasn't been set already.
364 */
365
366 if (Tcl_GetStartupScript(NULL) == NULL) {
367 const char *intvar = Tcl_GetVar(interp,
368 "tcl_interactive", TCL_GLOBAL_ONLY);
369
370 if (intvar == NULL) {
371 Tcl_SetVar(interp, "tcl_interactive", "1",
372 TCL_GLOBAL_ONLY);
373 }
351 if (getenv("TK_CONSOLE") ||
352 (!isatty(0) && (fstat(0, &st) ||
353 (S_ISCHR(st.st_mode) && st.st_blocks == 0)))) {
354 Tk_InitConsoleChannels(interp);
355 Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
356 Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
357 Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
358
359 /*
360 * Only show the console if we don't have a startup script
361 * and tcl_interactive hasn't been set already.
362 */
363
364 if (Tcl_GetStartupScript(NULL) == NULL) {
365 const char *intvar = Tcl_GetVar(interp,
366 "tcl_interactive", TCL_GLOBAL_ONLY);
367
368 if (intvar == NULL) {
369 Tcl_SetVar(interp, "tcl_interactive", "1",
370 TCL_GLOBAL_ONLY);
374371 }
375 if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
376 return TCL_ERROR;
377 }
372 }
373 if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
374 return TCL_ERROR;
378375 }
379376 }
380377 }
00 /*
11 * tkMacOSXKeyEvent.c --
22 *
3 * This file implements functions that decode & handle keyboard events
4 * on MacOS X.
3 * This file implements functions that decode & handle keyboard events on
4 * MacOS X.
55 *
66 * Copyright 2001, Apple Computer, Inc.
77 * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * The following terms apply to all files originating from Apple
13 * Computer, Inc. ("Apple") and associated with the software
14 * unless explicitly disclaimed in individual files.
15 *
16 *
17 * Apple hereby grants permission to use, copy, modify,
18 * distribute, and license this software and its documentation
19 * for any purpose, provided that existing copyright notices are
20 * retained in all copies and that this notice is included
21 * verbatim in any distributions. No written agreement, license,
22 * or royalty fee is required for any of the authorized
23 * uses. Modifications to this software may be copyrighted by
24 * their authors and need not follow the licensing terms
25 * described here, provided that the new terms are clearly
26 * indicated on the first page of each file where they apply.
27 *
28 *
29 * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE
30 * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
31 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
32 * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
33 * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND
35 * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
36 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
37 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS
38 * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE
39 * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
40 * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
41 *
42 * GOVERNMENT USE: If you are acquiring this software on behalf
43 * of the U.S. government, the Government shall have only
44 * "Restricted Rights" in the software and related documentation
45 * as defined in the Federal Acquisition Regulations (FARs) in
46 * Clause 52.227.19 (c) (2). If you are acquiring the software
47 * on behalf of the Department of Defense, the software shall be
48 * classified as "Commercial Computer Software" and the
49 * Government shall have only "Restricted Rights" as defined in
50 * Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the
51 * foregoing, the authors grant the U.S. Government and others
52 * acting in its behalf permission to use and distribute the
53 * software in accordance with the terms specified in this
54 * license.
55 *
56 * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.25 2008/09/02 16:10:55 das Exp $
12 * The following terms apply to all files originating from Apple Computer,
13 * Inc. ("Apple") and associated with the software unless explicitly
14 * disclaimed in individual files.
15 *
16 * Apple hereby grants permission to use, copy, modify, distribute, and
17 * license this software and its documentation for any purpose, provided
18 * that existing copyright notices are retained in all copies and that
19 * this notice is included verbatim in any distributions. No written
20 * agreement, license, or royalty fee is required for any of the
21 * authorized uses. Modifications to this software may be copyrighted by
22 * their authors and need not follow the licensing terms described here,
23 * provided that the new terms are clearly indicated on the first page of
24 * each file where they apply.
25 *
26 * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE SOFTWARE BE
27 * LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
28 * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS
29 * DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF APPLE OR THE AUTHORS
30 * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS
31 * AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT
32 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
33 * A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED
34 * ON AN "AS IS" BASIS, AND APPLE,THE AUTHORS AND DISTRIBUTORS HAVE NO
35 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
36 * MODIFICATIONS.
37 *
38 * GOVERNMENT USE: If you are acquiring this software on behalf of the
39 * U.S. government, the Government shall have only "Restricted Rights" in
40 * the software and related documentation as defined in the Federal
41 * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are
42 * acquiring the software on behalf of the Department of Defense, the
43 * software shall be classified as "Commercial Computer Software" and the
44 * Government shall have only "Restricted Rights" as defined in Clause
45 * 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
46 * authors grant the U.S. Government and others acting in its behalf
47 * permission to use and distribute the software in accordance with the
48 * terms specified in this license.
49 *
50 * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.26 2008/10/27 11:55:44 dkf Exp $
5751 */
5852
5953 #include "tkMacOSXPrivate.h"
9185 * Declarations for functions used only in this file.
9286 */
9387
94 static int InitKeyData(KeyEventData *keyEventDataPtr);
95 static int InitKeyEvent(XEvent *eventPtr, KeyEventData *e, UInt32 savedKeyCode,
96 UInt32 savedModifiers);
97 static int GenerateKeyEvent(UInt32 eKind, KeyEventData *e, UInt32 savedKeyCode,
98 UInt32 savedModifiers, const UniChar *chars, int numChars);
99 static int GetKeyboardLayout(Ptr *resourcePtr, TextEncoding *encodingPtr);
100 static TextEncoding GetKCHREncoding(ScriptCode script, SInt32 layoutid);
101 static int KeycodeToUnicodeViaUnicodeResource(UniChar *uniChars, int maxChars,
102 Ptr uchr, EventKind eKind, UInt32 keycode, UInt32 modifiers,
103 UInt32 *deadKeyStatePtr);
104 static int KeycodeToUnicodeViaKCHRResource(UniChar *uniChars, int maxChars,
105 Ptr kchr, TextEncoding encoding, EventKind eKind, UInt32 keycode,
106 UInt32 modifiers, UInt32 *deadKeyStatePtr);
107
88 static int GenerateKeyEvent(UInt32 eKind, KeyEventData *e,
89 UInt32 savedKeyCode, UInt32 savedModifiers,
90 const UniChar *chars, int numChars);
91 static TextEncoding GetKCHREncoding(ScriptCode script, SInt32 layoutid);
92 static int GetKeyboardLayout(Ptr *resourcePtr,
93 TextEncoding *encodingPtr);
94 static int InitKeyData(KeyEventData *keyEventDataPtr);
95 static int InitKeyEvent(XEvent *eventPtr, KeyEventData *e,
96 UInt32 savedKeyCode, UInt32 savedModifiers);
97 static int KeycodeToUnicodeViaKCHRResource(UniChar *uniChars,
98 int maxChars, Ptr kchr, TextEncoding encoding,
99 EventKind eKind, UInt32 keycode, UInt32 modifiers,
100 UInt32 *deadKeyStatePtr);
101 static int KeycodeToUnicodeViaUnicodeResource(UniChar *uniChars,
102 int maxChars, Ptr uchr, EventKind eKind,
103 UInt32 keycode, UInt32 modifiers,
104 UInt32 *deadKeyStatePtr);
108105
109106 /*
110107 *----------------------------------------------------------------------
111108 *
112109 * TkMacOSXProcessKeyboardEvent --
113110 *
114 * This routine processes the event in eventPtr, and
115 * generates the appropriate Tk events from it.
111 * This routine processes the event in eventPtr, and generates the
112 * appropriate Tk events from it.
116113 *
117114 * Results:
118115 * True if event(s) are generated - false otherwise.
149146 * accelerators through IsMenuKeyEvent. Tk treats accelerators as mere
150147 * decoration, and the user has to install bindings to get them to fire.
151148 *
152 * However, the only way to trigger the Hide & Hide Others functions
153 * is by invoking the Menu command for Hide. So there is no nice way to
154 * provide a Tk command to hide the app which would be available for a
155 * binding. So I am going to hijack Command-H and Command-Shift-H
156 * here, and run the menu commands. Since the HI Guidelines explicitly
157 * reserve these for Hide, this isn't such a bad thing. Also, if you do
158 * rebind Command-H to another menu item, Hide will lose its binding.
149 * However, the only way to trigger the Hide & Hide Others functions is by
150 * invoking the Menu command for Hide. So there is no nice way to provide a
151 * Tk command to hide the app which would be available for a binding. So I
152 * am going to hijack Command-H and Command-Shift-H here, and run the menu
153 * commands. Since the HI Guidelines explicitly reserve these for Hide,
154 * this isn't such a bad thing. Also, if you do rebind Command-H to another
155 * menu item, Hide will lose its binding.
159156 *
160 * Note that I don't really do anything at this point,
161 * I just mark stopProcessing as 0 and return, and then the
162 * RecieveAndProcessEvent code will dispatch the event to the default
163 * handler.
157 * Note that I don't really do anything at this point, I just mark
158 * stopProcessing as 0 and return, and then the RecieveAndProcessEvent code
159 * will dispatch the event to the default handler.
164160 */
165161
166162 if ((eventPtr->eKind == kEventRawKeyDown
171167
172168 GetMenuItemCommandID (menuRef, menuItemIndex, &menuCmd);
173169 switch (menuCmd) {
174 case kHICommandHide:
175 case kHICommandHideOthers:
176 case kHICommandShowAll:
177 case kHICommandPreferences:
178 case kHICommandQuit:
179 statusPtr->stopProcessing = 0;
180
181 /*
182 * TODO: may not be on event on queue.
183 */
184
185 return 0;
186 break;
187 default:
188 break;
170 case kHICommandHide:
171 case kHICommandHideOthers:
172 case kHICommandShowAll:
173 case kHICommandPreferences:
174 case kHICommandQuit:
175 statusPtr->stopProcessing = 0;
176
177 /*
178 * TODO: may not be on event on queue.
179 */
180
181 return 0;
182 default:
183 break;
189184 }
190185 }
191186
213208 }
214209
215210 switch (eventPtr->eKind) {
216 case kEventRawKeyUp:
217 case kEventRawKeyDown:
218 case kEventRawKeyRepeat: {
219 UInt32 *deadKeyStatePtr;
220
221 if (kEventRawKeyDown == eventPtr->eKind) {
222 deadKeyStatePtr = &deadKeyStateDown;
223 } else {
224 deadKeyStatePtr = &deadKeyStateUp;
225 }
226
227 uniCharsLen = TkMacOSXKeycodeToUnicode(uniChars,
228 sizeof(uniChars)/sizeof(*uniChars), eventPtr->eKind,
229 keyEventData.keyCode, keyEventData.keyModifiers,
230 deadKeyStatePtr);
231 break;
211 case kEventRawKeyUp:
212 case kEventRawKeyDown:
213 case kEventRawKeyRepeat: {
214 UInt32 *deadKeyStatePtr;
215
216 if (kEventRawKeyDown == eventPtr->eKind) {
217 deadKeyStatePtr = &deadKeyStateDown;
218 } else {
219 deadKeyStatePtr = &deadKeyStateUp;
232220 }
221
222 uniCharsLen = TkMacOSXKeycodeToUnicode(uniChars,
223 sizeof(uniChars)/sizeof(*uniChars), eventPtr->eKind,
224 keyEventData.keyCode, keyEventData.keyModifiers,
225 deadKeyStatePtr);
226 break;
227 }
233228 }
234229
235230 if (kEventRawKeyUp == eventPtr->eKind) {
273268 if (eventGenerated == 0) {
274269 savedKeyCode = keyEventData.message;
275270 return false;
276 } else if (eventGenerated == -1) {
271 }
272 if (eventGenerated == -1) {
277273 savedKeyCode = 0;
278274 statusPtr->stopProcessing = 0;
279275 return false;
280 } else {
281 savedKeyCode = 0;
282 return true;
283 }
276 }
277 savedKeyCode = 0;
278 return true;
284279 }
285280
286281 /*
288283 *
289284 * GenerateKeyEvent --
290285 *
291 * Given Macintosh keyUp, keyDown & autoKey events (in their "raw"
292 * form) and a list of unicode characters this function generates the
286 * Given Macintosh keyUp, keyDown & autoKey events (in their "raw" form)
287 * and a list of unicode characters this function generates the
293288 * appropriate X key events.
294289 *
295 * Parameter eKind is a raw keyboard event. e contains the data sent
296 * with the event. savedKeyCode and savedModifiers contain the values
297 * from the last event that came before (see
298 * TkMacOSXProcessKeyboardEvent()). chars/numChars has the Unicode
299 * characters for which we want to create events.
290 * Parameter eKind is a raw keyboard event. e contains the data sent with
291 * the event. savedKeyCode and savedModifiers contain the values from the
292 * last event that came before (see TkMacOSXProcessKeyboardEvent()).
293 * chars/numChars has the Unicode characters for which we want to create
294 * events.
300295 *
301296 * Results:
302297 * 1 if an event was generated, -1 for any error.
331326 }
332327
333328 /*
334 * Use special '-1' to signify a special keycode to our
335 * platform specific code in tkMacOSXKeyboard.c. This is
336 * rather like what happens on Windows.
329 * Use special '-1' to signify a special keycode to our platform
330 * specific code in tkMacOSXKeyboard.c. This is rather like what
331 * happens on Windows.
337332 */
338333
339334 event.xany.send_event = -1;
344339
345340 event.xkey.keycode = (e->keyModifiers ^ savedModifiers);
346341 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
347
348342 } else {
349343 for (i = 0; i < numChars; ++i) {
350344 /*
351345 * Encode one char in the trans_chars array that was already
352 * introduced for MS Windows. Don't encode the string, if it is
353 * a control character but was not generated with a real control
346 * introduced for MS Windows. Don't encode the string, if it is a
347 * control character but was not generated with a real control
354348 * modifier. Such control characters get generated by KeyTrans()
355 * for special keys, but we rather want to identify those by
356 * their KeySyms.
349 * for special keys, but we rather want to identify those by their
350 * KeySyms.
357351 */
358352
359353 event.xkey.trans_chars[0] = 0;
360354 if ((controlKey & e->keyModifiers) || (chars[i] >= ' ')) {
361 int done;
362 done = Tcl_UniCharToUtf(chars[i],event.xkey.trans_chars);
355 int done = Tcl_UniCharToUtf(chars[i],event.xkey.trans_chars);
356
363357 event.xkey.trans_chars[done] = 0;
364358 }
365359
366360 switch(eKind) {
367 case kEventRawKeyDown:
368 event.xany.type = KeyPress;
369 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
370 break;
371 case kEventRawKeyUp:
372 event.xany.type = KeyRelease;
373 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
374 break;
375 case kEventRawKeyRepeat:
376 event.xany.type = KeyRelease;
377 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
378 event.xany.type = KeyPress;
379 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
380 break;
381 default:
382 TkMacOSXDbgMsg("Invalid parameter eKind %ld", eKind);
383 return -1;
361 case kEventRawKeyDown:
362 event.xany.type = KeyPress;
363 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
364 break;
365 case kEventRawKeyUp:
366 event.xany.type = KeyRelease;
367 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
368 break;
369 case kEventRawKeyRepeat:
370 event.xany.type = KeyRelease;
371 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
372 event.xany.type = KeyPress;
373 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
374 break;
375 default:
376 TkMacOSXDbgMsg("Invalid parameter eKind %ld", eKind);
377 return -1;
384378 }
385379 }
386380 }
393387 *
394388 * InitKeyData --
395389 *
396 * This routine initializes a KeyEventData structure by asking the OS
397 * and Tk for all the global information needed here.
398 *
399 * Results:
400 * True if the current front window can be found in Tk data structures
401 * - false otherwise.
390 * This routine initializes a KeyEventData structure by asking the OS and
391 * Tk for all the global information needed here.
392 *
393 * Results:
394 * True if the current front window can be found in Tk data structures,
395 * false otherwise.
402396 *
403397 * Side Effects:
404398 * None
416410 if (keyEventDataPtr->whichWindow == NULL) {
417411 return false;
418412 }
413
419414 XQueryPointer(NULL, None, NULL, NULL, &keyEventDataPtr->global_x,
420415 &keyEventDataPtr->global_y, &keyEventDataPtr->local_x,
421416 &keyEventDataPtr->local_y, &keyEventDataPtr->state);
422
423417 return true;
424418 }
425419
441435 */
442436
443437 /*
444 * We have a general problem here. How do we handle 'Option-char'
445 * keypresses? The problem is that we might want to bind to some of these
446 * (e.g. Cmd-Opt-d is 'uncomment' in Alpha). OTOH Option-d actually produces
447 * a real character on MacOS, namely a mathematical delta.
438 * We have a general problem here. How do we handle 'Option-char' keypresses?
439 * The problem is that we might want to bind to some of these (e.g. Cmd-Opt-d
440 * is 'uncomment' in Alpha). OTOH Option-d actually produces a real character
441 * on MacOS, namely a mathematical delta.
448442 *
449443 * The current behaviour is that a binding goes by the combinations of
450 * modifiers and base keysym, that is Option-d. The string value of the
451 * event is the mathematical delta character, so if no binding calls
452 * [break], the text widget will insert that character.
444 * modifiers and base keysym, that is Option-d. The string value of the event
445 * is the mathematical delta character, so if no binding calls [break], the
446 * text widget will insert that character.
453447 *
454448 * Note that this is similar to control combinations on all platforms. They
455449 * also generate events that have the base character as keysym and a real
456 * control character as character value. So Ctrl+C gets us the keysym XK_C,
457 * the modifier Control (so you can bind <Control-C>) and a string value as
450 * control character as character value. So Ctrl+C gets us the keysym XK_C, the
451 * modifier Control (so you can bind <Control-C>) and a string value as
458452 * "\u0003".
459453 *
460454 * For a different solutions we may want for the event to contain keysyms for
461 * *both* the 'Opt-d' side of things and the mathematical delta. Then a
462 * binding on Opt-d will trigger, but a binding on mathematical delta would
463 * also trigger. This would require changes in the core, though.
455 * *both* the 'Opt-d' side of things and the mathematical delta. Then a binding
456 * on Opt-d will trigger, but a binding on mathematical delta would also
457 * trigger. This would require changes in the core, though.
464458 */
465459
466460 static int
475469 TkDisplay *dispPtr;
476470
477471 /*
478 * The focus must be in the FrontWindow on the Macintosh.
479 * We then query Tk to determine the exact Tk window
480 * that owns the focus.
472 * The focus must be in the FrontWindow on the Macintosh. We then query Tk
473 * to determine the exact Tk window that owns the focus.
481474 */
482475
483476 window = TkMacOSXGetXWindow(e->whichWindow);
506499 eventPtr->xkey.window = Tk_WindowId(tkwin);
507500 eventPtr->xkey.display = Tk_Display(tkwin);
508501 eventPtr->xkey.root = XRootWindow(Tk_Display(tkwin), 0);
509 eventPtr->xkey.state = e->state;
502 eventPtr->xkey.state = e->state;
510503 eventPtr->xkey.trans_chars[0] = 0;
511504
512505 Tk_TopCoordsToWindow(tkwin, e->local_x, e->local_y, &eventPtr->xkey.x,
514507
515508 eventPtr->xkey.keycode = e->ch | ((savedKeyCode & charCodeMask) << 8) |
516509 ((e->message&keyCodeMask) << 8);
517
518510 return 1;
519511 }
520512
529521 * Keyboard Layout Services, where available.
530522 *
531523 * Results:
532 * 1 if there is returned a Unicode 'uchr' resource in *resourcePtr, 0
533 * if it is a classic 'KCHR' resource. A pointer to the actual resource
534 * data goes into *resourcePtr. If the resource is a 'KCHR' resource,
535 * the corresponding Mac encoding goes into *encodingPtr.
524 * 1 if there is returned a Unicode 'uchr' resource in *resourcePtr, 0 if
525 * it is a classic 'KCHR' resource. A pointer to the actual resource data
526 * goes into *resourcePtr. If the resource is a 'KCHR' resource, the
527 * corresponding Mac encoding goes into *encodingPtr.
536528 *
537529 * Side effects:
538530 * Sets some internal static variables.
564556 KLGetCurrentKeyboardLayout(&currentLayout);
565557
566558 if (currentLayout != NULL) {
567
568559 /*
569560 * The layout pointer could in theory be the same for different
570561 * layouts, only the id gives us the information that the
573564 */
574565
575566 KLGetKeyboardLayoutProperty(currentLayout, kKLIdentifier,
576 (const void**)&currentLayoutId);
567 (const void **) &currentLayoutId);
577568
578569 if ((lastLayout != currentLayout)
579570 || (lastLayoutId != currentLayoutId)) {
580
581571 #ifdef TK_MAC_DEBUG_KEYBOARD
582572 TkMacOSXDbgMsg("Use KLS");
583573 #endif
584
585574 hasLayoutChanged = true;
586575
587576 /*
594583 KCHR = NULL;
595584
596585 if ((KLGetKeyboardLayoutProperty(currentLayout,
597 kKLuchrData, (const void**)&uchr)
598 == noErr)
586 kKLuchrData, (const void **) &uchr) == noErr)
599587 && (uchr != NULL)) {
600588 /* done */
601589 } else if ((KLGetKeyboardLayoutProperty(currentLayout,
602 kKLKCHRData, (const void**)&KCHR)
603 == noErr)
590 kKLKCHRData, (const void**)&KCHR) == noErr)
604591 && (KCHR != NULL)) {
605592 /* done */
606593 }
626613 * lastEncoding.
627614 *
628615 * If we didn't get a new 'KCHR' and if we have no 'uchr' either, get
629 * some 'KCHR' from the OS cache and leave lastEncoding at its
630 * current value. This should better not happen, it doesn't really
631 * work.
616 * some 'KCHR' from the OS cache and leave lastEncoding at its current
617 * value. This should better not happen, it doesn't really work.
632618 */
633619
634620 if (KCHR) {
639625 lastEncoding & ~0xFFFFL);
640626 #endif
641627 } else if (!uchr) {
642 KCHR = (Ptr)(intptr_t)GetScriptManagerVariable(smKCHRCache);
628 KCHR = (Ptr)(intptr_t) GetScriptManagerVariable(smKCHRCache);
643629 }
644630 }
645631
646632 if (uchr) {
647633 *resourcePtr = uchr;
648634 return 1;
649 } else {
650 *resourcePtr = KCHR;
651 *encodingPtr = lastEncoding;
652 return 0;
653 }
635 }
636 *resourcePtr = KCHR;
637 *encodingPtr = lastEncoding;
638 return 0;
654639 }
655640
656641 /*
697682 }
698683
699684 /*
700 * GetTextEncodingFromScriptInfo() doesn't know about more exotic
701 * layouts. This provides a fallback for good measure. In an ideal
702 * world, exotic layouts would always provide a 'uchr' resource anyway,
703 * so we wouldn't need this.
685 * GetTextEncodingFromScriptInfo() doesn't know about more exotic layouts.
686 * This provides a fallback for good measure. In an ideal world, exotic
687 * layouts would always provide a 'uchr' resource anyway, so we wouldn't
688 * need this.
704689 *
705 * We can add more keyboard layouts, if we get actual complaints. Farsi
706 * or other Celtic/Gaelic layouts would be candidates.
690 * We can add more keyboard layouts, if we get actual complaints. Farsi or
691 * other Celtic/Gaelic layouts would be candidates.
707692 */
708693
709694 switch (layoutid) {
712697 * Iceland for legacy applications.
713698 */
714699
715 case 1800: case 1821:
716 return kTextEncodingMacIcelandic;
700 case 1800: case 1821:
701 return kTextEncodingMacIcelandic;
717702
718703 /*
719704 * Irish and Welsh. These layouts are mentioned in <Script.h>.
722707 * can't locate layouts of this type for testing.
723708 */
724709
725 case 581: case 779:
726 return kTextEncodingMacCeltic;
710 case 581: case 779:
711 return kTextEncodingMacCeltic;
727712 }
728713
729714 /*
730 * The valid script codes are also the valid default encoding codes, so
731 * if nothing else helps, fall back on those.
715 * The valid script codes are also the valid default encoding codes, so if
716 * nothing else helps, fall back on those.
732717 */
733718
734719 return script;
740725 * KeycodeToUnicodeViaUnicodeResource --
741726 *
742727 * Given MacOS key event data this function generates the Unicode
743 * characters. It does this using a 'uchr' and the UCKeyTranslate
744 * API.
745 *
746 * The parameter deadKeyStatePtr can be NULL, if no deadkey handling
747 * is needed.
748 *
749 * Tested and known to work with US, Hebrew, Greek and Russian layouts
750 * as well as "Unicode Hex Input".
728 * characters. It does this using a 'uchr' and the UCKeyTranslate API.
729 *
730 * The parameter deadKeyStatePtr can be NULL, if no deadkey handling is
731 * needed.
732 *
733 * Tested and known to work with US, Hebrew, Greek and Russian layouts as
734 * well as "Unicode Hex Input".
751735 *
752736 * Results:
753737 * The number of characters generated if any, 0 if we are waiting for
754 * another byte of a dead-key sequence. Fills in the uniChars array
755 * with a Unicode string.
738 * another byte of a dead-key sequence. Fills in the uniChars array with a
739 * Unicode string.
756740 *
757741 * Side Effects:
758742 * None
788772 }
789773
790774 switch(eKind) {
791 case kEventRawKeyDown:
792 action = kUCKeyActionDown;
793 break;
794 case kEventRawKeyUp:
795 action = kUCKeyActionUp;
796 break;
797 case kEventRawKeyRepeat:
798 action = kUCKeyActionAutoKey;
799 break;
800 default:
801 TkMacOSXDbgMsg("Invalid parameter eKind %d", eKind);
802 return 0;
775 case kEventRawKeyDown:
776 action = kUCKeyActionDown;
777 break;
778 case kEventRawKeyUp:
779 action = kUCKeyActionUp;
780 break;
781 case kEventRawKeyRepeat:
782 action = kUCKeyActionAutoKey;
783 break;
784 default:
785 TkMacOSXDbgMsg("Invalid parameter eKind %d", eKind);
786 return 0;
803787 }
804788
805789 err = ChkErr(UCKeyTranslate, (const UCKeyboardLayout *) uchr, keycode,
815799 }
816800
817801 /*
818 * some IMEs leave residue :-(
802 * Some IMEs leave residue. :-(
819803 */
820804
821805 *deadKeyStatePtr = 0;
835819 * Given MacOS key event data this function generates the Unicode
836820 * characters. It does this using a 'KCHR' and the KeyTranslate API.
837821 *
838 * The parameter deadKeyStatePtr can be NULL, if no deadkey handling
839 * is needed.
822 * The parameter deadKeyStatePtr can be NULL, if no deadkey handling is
823 * needed.
840824 *
841825 * Results:
842826 * The number of characters generated if any, 0 if we are waiting for
843 * another byte of a dead-key sequence. Fills in the uniChars array
844 * with a Unicode string.
827 * another byte of a dead-key sequence. Fills in the uniChars array with a
828 * Unicode string.
845829 *
846830 * Side Effects:
847831 * None
863847 UInt32 result;
864848 char macBuff[3];
865849 char *macStr;
866 int macStrLen;
850 int macStrLen, uniStrLen;
867851 UInt32 dummy_state = 0;
852 CFStringRef cfString;
868853
869854 if (NULL == deadKeyStatePtr) {
870855 deadKeyStatePtr = &dummy_state;
876861 if ((0 == result) && (0 != dummy_state)) {
877862 /*
878863 * 'dummy_state' gets only filled if the caller did not want deadkey
879 * processing (deadKeyStatePtr was NULL originally), but we still
880 * have a deadkey. We just push the keycode for the space bar to get
881 * the real key value.
864 * processing (deadKeyStatePtr was NULL originally), but we still have
865 * a deadkey. We just push the keycode for the space bar to get the
866 * real key value.
882867 */
883868
884869 result = KeyTranslate(kchr, 0x31, deadKeyStatePtr);
894879 }
895880
896881 macBuff[0] = (char) (result >> 16);
897 macBuff[1] = (char) result;
882 macBuff[1] = (char) result;
898883 macBuff[2] = 0;
899884
900885 if (0 != macBuff[0]) {
901886 /*
902 * If the first byte is valid, the second is too
887 * If the first byte is valid, the second is too.
903888 */
904889
905890 macStr = macBuff;
906891 macStrLen = 2;
907892 } else if (0 != macBuff[1]) {
908893 /*
909 * Only the second is valid
894 * Only the second is valid.
910895 */
911896
912897 macStr = macBuff+1;
913898 macStrLen = 1;
914899 } else {
915900 /*
916 * No valid bytes at all -- shouldn't happen
901 * No valid bytes at all -- shouldn't happen.
917902 */
918903
919904 macStr = NULL;
922907
923908 if (macStrLen <= 0) {
924909 return 0;
925 } else {
926
927 /*
928 * Use the CFString conversion routines. This is the easiest and
929 * most compatible way to get from an 8-bit string and a MacOS script
930 * code to a Unicode string.
931 *
932 * FIXME: The system ships with an Irish 'KCHR' but without the
933 * corresponding macCeltic encoding, which triggers the error below.
934 * Tcl doesn't have the macCeltic encoding either right now, so until
935 * we get that, we can just as well stick to this code. The right
936 * fix would be to use the Tcl encodings and add macCeltic and
937 * probably others there. Suitable Unicode data files for the
938 * missing encodings are available from www.evertype.com.
939 */
940
941 CFStringRef cfString;
942 int uniStrLen;
943
944 cfString = CFStringCreateWithCStringNoCopy(NULL, macStr, encoding,
945 kCFAllocatorNull);
946 if (cfString == NULL) {
947 TkMacOSXDbgMsg("CFString: Can't convert with encoding %ld",
948 encoding);
949 return 0;
950 }
951
952 uniStrLen = CFStringGetLength(cfString);
953 if (uniStrLen > maxChars) {
954 uniStrLen = maxChars;
955 }
956 CFStringGetCharacters(cfString, CFRangeMake(0,uniStrLen), uniChars);
957 CFRelease(cfString);
958
959 return uniStrLen;
960 }
910 }
911
912 /*
913 * Use the CFString conversion routines. This is the easiest and most
914 * compatible way to get from an 8-bit string and a MacOS script code to a
915 * Unicode string.
916 *
917 * FIXME: The system ships with an Irish 'KCHR' but without the
918 * corresponding macCeltic encoding, which triggers the error below. Tcl
919 * doesn't have the macCeltic encoding either right now, so until we get
920 * that, we can just as well stick to this code. The right fix would be to
921 * use the Tcl encodings and add macCeltic and probably others
922 * there. Suitable Unicode data files for the missing encodings are
923 * available from www.evertype.com.
924 */
925
926 cfString = CFStringCreateWithCStringNoCopy(NULL, macStr, encoding,
927 kCFAllocatorNull);
928 if (cfString == NULL) {
929 TkMacOSXDbgMsg("CFString: Can't convert with encoding %ld", encoding);
930 return 0;
931 }
932
933 uniStrLen = CFStringGetLength(cfString);
934 if (uniStrLen > maxChars) {
935 uniStrLen = maxChars;
936 }
937 CFStringGetCharacters(cfString, CFRangeMake(0,uniStrLen), uniChars);
938 CFRelease(cfString);
939
940 return uniStrLen;
961941 }
962942
963943 /*
968948 * Given MacOS key event data this function generates the Unicode
969949 * characters. It does this using OS resources and APIs.
970950 *
971 * The parameter deadKeyStatePtr can be NULL, if no deadkey handling
972 * is needed.
973 *
974 * This function is called from XKeycodeToKeysym() in
975 * tkMacOSKeyboard.c.
951 * The parameter deadKeyStatePtr can be NULL, if no deadkey handling is
952 * needed.
953 *
954 * This function is called from XKeycodeToKeysym() in tkMacOSKeyboard.c.
976955 *
977956 * Results:
978957 * The number of characters generated if any, 0 if we are waiting for
979 * another byte of a dead-key sequence. Fills in the uniChars array
980 * with a Unicode string.
958 * another byte of a dead-key sequence. Fills in the uniChars array with a
959 * Unicode string.
981960 *
982961 * Side Effects:
983962 * None
996975 {
997976 Ptr resource = NULL;
998977 TextEncoding encoding;
999 int len;
1000
1001
1002 if (GetKeyboardLayout(&resource,&encoding)) {
1003 len = KeycodeToUnicodeViaUnicodeResource(
1004 uniChars, maxChars, resource, eKind,
1005 keycode, modifiers, deadKeyStatePtr);
978
979 if (GetKeyboardLayout(&resource, &encoding)) {
980 return KeycodeToUnicodeViaUnicodeResource(uniChars, maxChars,
981 resource, eKind, keycode, modifiers, deadKeyStatePtr);
1006982 } else {
1007 len = KeycodeToUnicodeViaKCHRResource(
1008 uniChars, maxChars, resource, encoding, eKind,
1009 keycode, modifiers, deadKeyStatePtr);
1010 }
1011
1012 return len;
983 return KeycodeToUnicodeViaKCHRResource(uniChars, maxChars, resource,
984 encoding, eKind, keycode, modifiers, deadKeyStatePtr);
985 }
1013986 }
1014987
1015988 /*
10381011 Time time)
10391012 {
10401013 keyboardGrabWinPtr = Tk_IdToWindow(display, grab_window);
1014
10411015 return GrabSuccess;
10421016 }
10431017
10891063 *
10901064 * TkpSetCapture --
10911065 *
1092 * This function captures the mouse so that all future events
1093 * will be reported to this window, even if the mouse is outside
1094 * the window. If the specified window is NULL, then the mouse
1095 * is released.
1066 * This function captures the mouse so that all future events will be
1067 * reported to this window, even if the mouse is outside the window. If
1068 * the specified window is NULL, then the mouse is released.
10961069 *
10971070 * Results:
10981071 * None.
11191092 w = winPtr;
11201093 m = kWindowModalityAppModal;
11211094 } else if (grabWinPtr) {
1122 w = (TkWindow*)grabWinPtr;
1095 w = (TkWindow *) grabWinPtr;
11231096 m = kWindowModalityNone;
11241097 }
1098
11251099 if (w && w->window != None && TkMacOSXHostToplevelExists(w)) {
11261100 ChkErr(SetWindowModality, TkMacOSXDrawableWindow(w->window), m,
11271101 NULL);
11361110 *
11371111 * Tk_SetCaretPos --
11381112 *
1139 * This enables correct placement of the XIM caret. This is called
1140 * by widgets to indicate their cursor placement, and the caret
1141 * location is used by TkpGetString to place the XIM caret.
1113 * This enables correct placement of the XIM caret. This is called by
1114 * widgets to indicate their cursor placement, and the caret location is
1115 * used by TkpGetString to place the XIM caret.
11421116 *
11431117 * Results:
11441118 * None
11831157
11841158 GetKeyboardLayout(&resource, &encoding);
11851159 }
1160
1161 /*
1162 * Local Variables:
1163 * mode: c
1164 * c-basic-offset: 4
1165 * fill-column: 79
1166 * coding: utf-8
1167 * End:
1168 */
99 * See the file "license.terms" for information on usage and redistribution
1010 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkMacOSXKeyboard.c,v 1.23 2007/12/13 15:27:10 dgp Exp $
12 * RCS: @(#) $Id: tkMacOSXKeyboard.c,v 1.24 2008/10/27 11:55:44 dkf Exp $
1313 */
1414
1515 #include "tkMacOSXInt.h"
163163 *
164164 * InitLatin1Table --
165165 *
166 * Creates a simple table to be used for mapping from keysyms to
167 * keycodes. Always needs to be called before using latin1Table,
168 * because the keyboard layout may have changed, and than the table must
169 * be re-computed.
166 * Creates a simple table to be used for mapping from keysyms to keycodes.
167 * Always needs to be called before using latin1Table, because the
168 * keyboard layout may have changed, and than the table must be
169 * re-computed.
170170 *
171171 * Results:
172172 * None.
203203
204204 /*
205205 * In the common X11 implementations, a keymap has four columns
206 * "plain", "Shift", "Mode_switch" and "Mode_switch + Shift". We
207 * don't use "Mode_switch", but we use "Option" instead. (This is
208 * similar to Apple's X11 implementation, where "Mode_switch" is used
209 * as an alias for "Option".)
206 * "plain", "Shift", "Mode_switch" and "Mode_switch + Shift". We don't
207 * use "Mode_switch", but we use "Option" instead. (This is similar to
208 * Apple's X11 implementation, where "Mode_switch" is used as an alias
209 * for "Option".)
210210 *
211211 * So here we go through all 4 columns of the keymap and find all
212 * Latin-1 compatible keycodes. We go through the columns
213 * back-to-front from the more exotic columns to the more simple, so
214 * that simple keycode-modifier combinations are preferred in the
215 * resulting table.
212 * Latin-1 compatible keycodes. We go through the columns back-to-front
213 * from the more exotic columns to the more simple, so that simple
214 * keycode-modifier combinations are preferred in the resulting table.
216215 */
217216
218217 for (state = 3; state >= 0; state--) {
268267 }
269268
270269 /*
271 * When determining what keysym to produce we first check to see if the
272 * key is a function key. We then check to see if the character is
273 * another non-printing key. Finally, we return the key syms for all
274 * ASCII and Latin-1 chars.
270 * When determining what keysym to produce we first check to see if the key
271 * is a function key. We then check to see if the character is another
272 * non-printing key. Finally, we return the key syms for all ASCII and
273 * Latin-1 chars.
275274 */
276275
277276 newKeycode = keycode >> 16;
299298 }
300299
301300 newChar = 0;
302 TkMacOSXKeycodeToUnicode(
303 &newChar, 1, kEventRawKeyDown,
304 newKeycode & 0x00FF, newKeycode & 0xFF00, NULL);
305
306 /*
307 * X11 keysyms are identical to Unicode for ASCII and Latin-1. Give up
308 * for other characters for now.
301 TkMacOSXKeycodeToUnicode(&newChar, 1, kEventRawKeyDown,
302 newKeycode & 0x00FF, newKeycode & 0xFF00, NULL);
303
304 /*
305 * X11 keysyms are identical to Unicode for ASCII and Latin-1. Give up for
306 * other characters for now.
309307 */
310308
311309 if ((newChar >= XK_space) && (newChar <= LATIN1_MAX)) {
362360
363361 XModifierKeymap *
364362 XGetModifierMapping(
365 Display* display)
366 {
367 XModifierKeymap * modmap;
363 Display *display)
364 {
365 XModifierKeymap *modmap;
368366
369367 (void) display; /*unused*/
370368
371369 /*
372 * MacOSX doesn't use the key codes for the modifiers for anything, and
373 * we don't generate them either. So there is no modifier map.
370 * MacOSX doesn't use the key codes for the modifiers for anything, and we
371 * don't generate them either. So there is no modifier map.
374372 */
375373
376374 modmap = (XModifierKeymap *) ckalloc(sizeof(XModifierKeymap));
411409 * XKeysymToString, XStringToKeysym --
412410 *
413411 * These X window functions map keysyms to strings & strings to keysyms.
414 * However, Tk already does this for the most common keysyms.
415 * Therefore, these functions only need to support keysyms that will be
416 * specific to the Macintosh. Currently, there are none.
412 * However, Tk already does this for the most common keysyms. Therefore,
413 * these functions only need to support keysyms that will be specific to
414 * the Macintosh. Currently, there are none.
417415 *
418416 * Results:
419417 * None.
443441 *
444442 * XKeysymToMacKeycode --
445443 *
446 * An internal function like XKeysymToKeycode but only generating the
447 * Mac specific keycode plus the modifiers Shift and Option.
444 * An internal function like XKeysymToKeycode but only generating the Mac
445 * specific keycode plus the modifiers Shift and Option.
448446 *
449447 * Results:
450448 * A Mac keycode with the actual keycode in the low byte and Mac-style
461459 Display *display,
462460 KeySym keysym)
463461 {
462 KeyInfo *kPtr;
463
464464 if (keysym <= LATIN1_MAX) {
465
466465 /*
467466 * Handle keysyms in the Latin-1 range where keysym and Unicode
468467 * character code point are the same.
470469
471470 InitLatin1Table(display);
472471 return latin1Table[keysym];
473
474 } else {
475
476 /*
477 * Handle special keys from our exception tables. Don't mind if this
478 * is slow, neither the test suite nor [event generate] need to be
479 * optimized (we hope).
480 */
481
482 KeyInfo *kPtr;
483
484 for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) {
485 if (kPtr->keysym == keysym) {
486 return kPtr->keycode;
487 }
488 }
489 for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) {
490 if (kPtr->keysym == keysym) {
491 return kPtr->keycode;
492 }
493 }
494
495 /*
496 * For other keysyms (not Latin-1 and not special keys), we'd need a
497 * generic keysym-to-unicode table. We don't have that, so we give
498 * up here.
499 */
500
501 return 0;
502 }
472 }
473
474 /*
475 * Handle special keys from our exception tables. Don't mind if this is
476 * slow, neither the test suite nor [event generate] need to be optimized
477 * (we hope).
478 */
479
480 for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) {
481 if (kPtr->keysym == keysym) {
482 return kPtr->keycode;
483 }
484 }
485 for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) {
486 if (kPtr->keysym == keysym) {
487 return kPtr->keycode;
488 }
489 }
490
491 /*
492 * For other keysyms (not Latin-1 and not special keys), we'd need a
493 * generic keysym-to-unicode table. We don't have that, so we give up here.
494 */
495
496 return 0;
503497 }
504498
505499 /*
507501 *
508502 * XKeysymToKeycode --
509503 *
510 * The function XKeysymToKeycode takes an X11 keysym and converts it
511 * into a Mac keycode. It is in the stubs table for compatibility but
512 * not used anywhere in the core.
504 * The function XKeysymToKeycode takes an X11 keysym and converts it into
505 * a Mac keycode. It is in the stubs table for compatibility but not used
506 * anywhere in the core.
513507 *
514508 * Results:
515509 * A 32 bit keycode with the the mac keycode (without modifiers) in the
579573 *
580574 * The function TkpSetKeycodeAndState takes a keysym and fills in the
581575 * appropriate members of an XEvent. It is similar to XKeysymToKeycode,
582 * but it also sets the modifier mask in the XEvent. It is used by
583 * [event generate] and it is in the stubs table.
576 * but it also sets the modifier mask in the XEvent. It is used by [event
577 * generate] and it is in the stubs table.
584578 *
585579 * Results:
586580 * Fills an XEvent, sets the member xkey.keycode with a keycode
625619 }
626620
627621 if (keysym <= LATIN1_MAX) {
628 int done;
629 done = Tcl_UniCharToUtf(keysym,eventPtr->xkey.trans_chars);
622 int done = Tcl_UniCharToUtf(keysym, eventPtr->xkey.trans_chars);
623
630624 eventPtr->xkey.trans_chars[done] = 0;
631625 } else {
632626 eventPtr->xkey.trans_chars[0] = 0;
676670
677671 if (eventPtr->xany.send_event == -1) {
678672 int modifier = eventPtr->xkey.keycode;
673
679674 if (modifier == cmdKey) {
680675 return XK_Meta_L;
681676 } else if (modifier == shiftKey) {
697692 } else if (modifier == rightControlKey) {
698693 return XK_Control_R;
699694 } else {
700
701695 /*
702696 * If we get here, we probably need to implement something new.
703697 */
707701 }
708702
709703 /*
710 * Figure out which of the four slots in the keymap vector to use for
711 * this key. Refer to Xlib documentation for more info on how this
712 * computation works. (Note: We use "Option" in keymap columns 2 and 3
713 * where other implementations have "Mode_switch".)
704 * Figure out which of the four slots in the keymap vector to use for this
705 * key. Refer to Xlib documentation for more info on how this computation
706 * works. (Note: We use "Option" in keymap columns 2 and 3 where other
707 * implementations have "Mode_switch".)
714708 */
715709
716710 index = 0;
728722
729723 if ((eventPtr->xkey.state & ShiftMask)
730724 || (/* (dispPtr->lockUsage != LU_IGNORE)
731 && */ (eventPtr->xkey.state & LockMask))) {
725 && */ (eventPtr->xkey.state & LockMask))) {
732726 index |= 1;
733727 }
734728
740734
741735 /*
742736 * Special handling: If the key was shifted because of Lock, but lock is
743 * only caps lock, not shift lock, and the shifted keysym isn't
744 * upper-case alphabetic, then switch back to the unshifted keysym.
737 * only caps lock, not shift lock, and the shifted keysym isn't upper-case
738 * alphabetic, then switch back to the unshifted keysym.
745739 */
746740
747741 if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
748742 /*&& (dispPtr->lockUsage == LU_CAPS)*/ ) {
749
750743 /*
751 * FIXME: Keysyms are only identical to Unicode for ASCII and
752 * Latin-1, so we can't use Tcl_UniCharIsUpper() for keysyms outside
753 * that range. This may be a serious problem here.
744 * FIXME: Keysyms are only identical to Unicode for ASCII and Latin-1,
745 * so we can't use Tcl_UniCharIsUpper() for keysyms outside that range.
746 * This may be a serious problem here.
754747 */
755748
756749 if ((sym == NoSymbol) || (sym > LATIN1_MAX)
778771 *
779772 * TkpInitKeymapInfo --
780773 *
781 * This procedure is invoked to scan keymap information to recompute
782 * stuff that's important for binding, such as the modifier key (if any)
783 * that corresponds to the "Mode_switch" keysym.
774 * This procedure is invoked to scan keymap information to recompute stuff
775 * that's important for binding, such as the modifier key (if any) that
776 * corresponds to the "Mode_switch" keysym.
784777 *
785778 * Results:
786779 * None.
800793
801794 /*
802795 * Behaviours that are variable on X11 are defined constant on MacOSX.
803 * lockUsage is only used above in TkpGetKeySym(), nowhere else
804 * currently. There is no offical "Mode_switch" key.
796 * lockUsage is only used above in TkpGetKeySym(), nowhere else currently.
797 * There is no offical "Mode_switch" key.
805798 */
806799
807800 dispPtr->lockUsage = LU_CAPS;
825818
826819 /*
827820 * MacOSX doesn't use the keycodes for the modifiers for anything, and we
828 * don't generate them either (the keycodes actually given in the
829 * simulated modifier events are bogus). So there is no modifier map.
830 * If we ever want to simulate real modifier keycodes, the list will be
831 * constant in the Carbon implementation.
821 * don't generate them either (the keycodes actually given in the simulated
822 * modifier events are bogus). So there is no modifier map. If we ever want
823 * to simulate real modifier keycodes, the list will be constant in the
824 * Carbon implementation.
832825 */
833826
834827 if (dispPtr->modKeyCodes != NULL) {
837830 dispPtr->numModKeyCodes = 0;
838831 dispPtr->modKeyCodes = NULL;
839832 }
833
834 /*
835 * Local Variables:
836 * mode: c
837 * c-basic-offset: 4
838 * fill-column: 79
839 * coding: utf-8
840 * End:
841 */
66 * Copyright 2001, Apple Computer, Inc.
77 * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
88 *
9 * See the file "license.terms" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.45 2007/12/13 15:27:10 dgp Exp $
9 * See the file "license.terms" for information on usage and redistribution of
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.49 2008/12/09 21:22:56 dgp Exp $
1313 */
1414
1515 #include "tkMacOSXPrivate.h"
6868 */
6969
7070 typedef struct EntryGeometry {
71 int accelTextStart; /* Offset into the accel string where
72 * the text starts. Everything before
73 * this is modifier key descriptions.
74 */
71 int accelTextStart; /* Offset into the accel string where the text
72 * starts. Everything before this is modifier
73 * key descriptions. */
7574 int modifierWidth; /* Width of modifier symbols. */
7675 int accelTextWidth; /* Width of the text after the modifier
7776 * keys. */
78 int nonAccelMargin; /* The width of the margin for entries
79 * without accelerators. */
77 int nonAccelMargin; /* The width of the margin for entries without
78 * accelerators. */
8079 int modifierNum; /* Number of modifiers */
8180 Tcl_UniChar modifierUniChars[MODIFIER_NUM];
8281 /* Modifiers in unicode */
9190 struct TopLevelMenubarList *nextPtr;
9291 /* The next window in the list. */
9392 Tk_Window tkwin; /* The toplevel window. */
94 TkMenu *menuPtr; /* The menu associated with this
95 * toplevel. */
93 TkMenu *menuPtr; /* The menu associated with this toplevel. */
9694 } TopLevelMenubarList;
9795
9896 /*
9997 * Platform-specific flags for menus.
10098 *
101 * MENU_APPLE_MENU 0 indicates a custom Apple menu has
102 * not been installed; 1 a custom Apple
103 * menu has been installed.
104 * MENU_HELP_MENU 0 indicates a custom Help menu has
105 * not been installed; 1 a custom Help
106 * menu has been installed.
107 * MENU_RECONFIGURE_PENDING 1 indicates that an idle handler has
108 * been scheduled to reconfigure the
109 * Macintosh MenuHandle.
99 * MENU_APPLE_MENU 0 indicates a custom Apple menu has not been
100 * installed; 1 a custom Apple menu has been
101 * installed.
102 * MENU_HELP_MENU 0 indicates a custom Help menu has not been
103 * installed; 1 a custom Help menu has been
104 * installed.
105 * MENU_RECONFIGURE_PENDING 1 indicates that an idle handler has been
106 * scheduled to reconfigure the Macintosh
107 * MenuHandle.
110108 */
111109
112110 #define MENU_APPLE_MENU MENU_PLATFORM_FLAG1
117115 * menus. */
118116 #define MENUBAR_REDRAW_PENDING 1
119117
120 static int gNoTkMenus = 0; /* This is used by Tk_MacOSXTurnOffMenus as the
121 * flag that Tk is not to draw any menus. */
118 static int gNoTkMenus = 0; /* This is used by Tk_MacOSXTurnOffMenus as
119 * the flag that Tk is not to draw any
120 * menus. */
122121
123122 static Tcl_HashTable commandTable;
124 /* The list of menuInstancePtrs associated with
125 * menu ids */
123 /* The list of menuInstancePtrs associated
124 * with menu ids. */
126125 static short currentAppleMenuID;
127126 /* The id of the current Apple menu. 0 for
128127 * none. */
129128 static short currentHelpMenuID; /* The id of the current Help menu. 0 for
130129 * none. */
131130 static Tcl_Interp *currentMenuBarInterp;
132 /* The interpreter of the window that owns
133 * the current menubar. */
131 /* The interpreter of the window that owns the
132 * current menubar. */
134133 static char *currentMenuBarName;
135134 /* Malloced. Name of current menu in menu bar.
136135 * NULL if no menu set. TO DO: make this a
137136 * DString. */
138137 static Tk_Window currentMenuBarOwner;
139138 /* Which window owns the current menu bar. */
140 static int inPostMenu; /* We cannot be re-entrant like X
141 * windows. */
142 static short lastMenuID; /* To pass to NewMenu; need to figure out
143 * a good way to do this. */
144 static short lastCascadeID;
145 /* Cascades have to have ids that are
146 * less than 256. */
139 static int inPostMenu; /* We cannot be re-entrant like X windows. */
140 static short lastMenuID; /* To pass to NewMenu; need to figure out a
141 * good way to do this. */
142 static short lastCascadeID; /* Cascades have to have ids that are less
143 * than 256. */
147144 static int menuBarFlags; /* Used for whether the menu bar needs
148145 * redrawing or not. */
149146
159156 * Array of unicode, charcode and utf representations of the most common
160157 * special menu symbols.
161158 */
159
162160 typedef struct MenuSymbol {
163161 const Tcl_UniChar unicode;
164162 const char charCode;
201199 * Forward declarations for procedures defined later in this file:
202200 */
203201
204 MODULE_SCOPE int TkMacOSXGetNewMenuID(Tcl_Interp *interp, TkMenu *menuInstPtr,
205 int cascade, short *menuIDPtr);
206 MODULE_SCOPE void TkMacOSXFreeMenuID(short menuID);
207
208 static void CompleteIdlers(TkMenu *menuPtr);
209 static void DrawMenuBarWhenIdle(ClientData clientData);
210 static void DrawMenuEntryAccelerator(TkMenu *menuPtr, TkMenuEntry *mePtr,
211 Drawable d, GC gc, Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
212 Tk_3DBorder activeBorder, int x, int y, int width, int height,
213 int drawArrow);
214 static void DrawMenuEntryBackground(TkMenu *menuPtr, TkMenuEntry *mePtr,
215 Drawable d, Tk_3DBorder activeBorder, Tk_3DBorder bgBorder, int x,
216 int y, int width, int heigth);
217 static void DrawMenuEntryIndicator(TkMenu *menuPtr, TkMenuEntry *mePtr,
218 Drawable d, GC gc, GC indicatorGC, Tk_Font tkfont,
219 const Tk_FontMetrics *fmPtr, int x, int y, int width, int height);
220 static void DrawMenuEntryLabel(TkMenu * menuPtr, TkMenuEntry *mePtr,
221 Drawable d, GC gc, Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int x,
222 int y, int width, int height);
223 static void DrawMenuSeparator(TkMenu *menuPtr, TkMenuEntry *mePtr, Drawable d,
224 GC gc, Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int x, int y,
225 int width, int height);
226 static void DrawTearoffEntry(TkMenu *menuPtr, TkMenuEntry *mePtr, Drawable d,
227 GC gc, Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int x, int y,
228 int width, int height);
229 static void EventuallyInvokeMenu(ClientData data);
230 static void GetEntryText(TkMenuEntry *mePtr, Tcl_DString *dStringPtr);
231 static void GetMenuAccelGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr,
232 Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int *modWidthPtr,
233 int *textWidthPtr, int *heightPtr);
234 static void GetMenuLabelGeometry(TkMenuEntry *mePtr, Tk_Font tkfont,
235 const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr);
236 static void GetMenuIndicatorGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr,
237 Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int *widthPtr,
238 int *heightPtr);
239 static void GetMenuSeparatorGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr,
240 Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int *widthPtr,
241 int *heightPtr);
242 static TkMenuEntry* GetParentMenuEntry(TkMenu *menuPtr);
243 static void GetTearoffEntryGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr,
244 Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int *widthPtr,
245 int *heightPtr);
246 static char FindMarkCharacter(TkMenuEntry *mePtr);
247 static int GetUtfMarkCharacter(char markChar, const char **markUtfPtr);
248 static TkMenu* MenuPtrForMenuRef(MenuRef menu);
249 static int ParseAccelerators(const char **accelStringPtr, int *modifierNumPtr,
250 Tcl_UniChar *modifierUniChars, int *modifierWidth);
251 static void MenuSelectEvent(TkMenu *menuPtr);
252 static void ReconfigureIndividualMenu(TkMenu *menuPtr, MenuHandle macMenuHdl,
253 int base);
254 static void ReconfigureMacintoshMenu(ClientData clientData);
255 static void RecursivelyClearActiveMenu(TkMenu *menuPtr);
256 static void RecursivelyDeleteMenu(TkMenu *menuPtr);
257 static void RecursivelyInsertMenu(TkMenu *menuPtr);
258 static void SetDefaultMenubar(void);
259 static int SetMenuCascade(TkMenu *menuPtr);
202 MODULE_SCOPE int TkMacOSXGetNewMenuID(Tcl_Interp *interp,
203 TkMenu *menuInstPtr, int cascade,
204 short *menuIDPtr);
205 MODULE_SCOPE void TkMacOSXFreeMenuID(short menuID);
206
207 static void CompleteIdlers(TkMenu *menuPtr);
208 static void DrawMenuBarWhenIdle(ClientData clientData);
209 static void DrawMenuEntryAccelerator(TkMenu *menuPtr,
210 TkMenuEntry *mePtr, Drawable d, GC gc,
211 Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
212 Tk_3DBorder activeBorder, int x, int y, int width,
213 int height, int drawArrow);
214 static void DrawMenuEntryBackground(TkMenu *menuPtr,
215 TkMenuEntry *mePtr, Drawable d,
216 Tk_3DBorder activeBorder, Tk_3DBorder bgBorder,
217 int x, int y, int width, int heigth);
218 static void DrawMenuEntryIndicator(TkMenu *menuPtr,
219 TkMenuEntry *mePtr, Drawable d, GC gc,
220 GC indicatorGC, Tk_Font tkfont,
221 const Tk_FontMetrics *fmPtr, int x, int y,
222 int width, int height);
223 static void DrawMenuEntryLabel(TkMenu *menuPtr,TkMenuEntry *mePtr,
224 Drawable d, GC gc, Tk_Font tkfont,
225 const Tk_FontMetrics *fmPtr, int x, int y,
226 int width, int height);
227 static void DrawMenuSeparator(TkMenu *menuPtr, TkMenuEntry *mePtr,
228 Drawable d, GC gc, Tk_Font tkfont,
229 const Tk_FontMetrics *fmPtr, int x, int y,
230 int width, int height);
231 static void DrawTearoffEntry(TkMenu *menuPtr, TkMenuEntry *mePtr,
232 Drawable d, GC gc, Tk_Font tkfont,
233 const Tk_FontMetrics *fmPtr, int x, int y,
234 int width, int height);
235 static void EventuallyInvokeMenu(ClientData data);
236 static void GetEntryText(TkMenuEntry *mePtr,
237 Tcl_DString *dStringPtr);
238 static void GetMenuAccelGeometry(TkMenu *menuPtr,
239 TkMenuEntry *mePtr, Tk_Font tkfont,
240 const Tk_FontMetrics *fmPtr, int *modWidthPtr,
241 int *textWidthPtr, int *heightPtr);
242 static void GetMenuLabelGeometry(TkMenuEntry *mePtr,
243 Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
244 int *widthPtr, int *heightPtr);
245 static void GetMenuIndicatorGeometry(TkMenu *menuPtr,
246 TkMenuEntry *mePtr, Tk_Font tkfont,
247 const Tk_FontMetrics *fmPtr, int *widthPtr,
248 int *heightPtr);
249 static void GetMenuSeparatorGeometry(TkMenu *menuPtr,
250 TkMenuEntry *mePtr, Tk_Font tkfont,
251 const Tk_FontMetrics *fmPtr, int *widthPtr,
252 int *heightPtr);
253 static TkMenuEntry * GetParentMenuEntry(TkMenu *menuPtr);
254 static void GetTearoffEntryGeometry(TkMenu *menuPtr,
255 TkMenuEntry *mePtr, Tk_Font tkfont,
256 const Tk_FontMetrics *fmPtr, int *widthPtr,
257 int *heightPtr);
258 static char FindMarkCharacter(TkMenuEntry *mePtr);
259 static int GetUtfMarkCharacter(char markChar,
260 const char **markUtfPtr);
261 static TkMenu * MenuPtrForMenuRef(MenuRef menu);
262 static int ParseAccelerators(const char **accelStringPtr,
263 int *modifierNumPtr,
264 Tcl_UniChar *modifierUniChars,
265 int *modifierWidth);
266 static void MenuSelectEvent(TkMenu *menuPtr);
267 static void ReconfigureIndividualMenu(TkMenu *menuPtr,
268 MenuHandle macMenuHdl, int base);
269 static void ReconfigureMacintoshMenu(ClientData clientData);
270 static void RecursivelyClearActiveMenu(TkMenu *menuPtr);
271 static void RecursivelyDeleteMenu(TkMenu *menuPtr);
272 static void RecursivelyInsertMenu(TkMenu *menuPtr);
273 static void SetDefaultMenubar(void);
274 static int SetMenuCascade(TkMenu *menuPtr);
260275
261276 #ifdef USE_TK_MDEF
262277 #define SCREEN_MARGIN 5
263278 static MacDrawable macMDEFDrawable;
264279 /* Drawable for use by MDEF code */
265 static int MDEFScrollFlag = 0; /* Used so that popups don't scroll too soon.*/
280 static int MDEFScrollFlag = 0; /* Used so that popups don't scroll too
281 * soon. */
266282 static MenuItemDrawingUPP tkThemeMenuItemDrawingUPP;
267 /* Points to the UPP for theme Item drawing. */
283 /* Points to the UPP for theme Item
284 * drawing. */
268285 static Tcl_Obj *useMDEFVar;
269286
270 static void DrawMenuBackground(TkMenu *menuPtr, Rect *menuRectPtr,
271 Drawable d);
272 static void MenuDefProc(short message, MenuHandle menu, Rect *menuRectPtr,
273 Point hitPt, short *whichItem );
274 static void HandleMenuHiliteMsg(MenuRef menu, Rect *menuRectPtr, Point hitPt,
275 SInt16 *whichItem, TkMenu *menuPtr);
276 static void HandleMenuDrawMsg(MenuRef menu, Rect *menuRectPtr, Point hitPt,
277 SInt16 *whichItem, TkMenu *menuPtr);
278 static void HandleMenuFindItemMsg(MenuRef menu, Rect *menuRectPtr,
279 Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
280 static void HandleMenuPopUpMsg(MenuRef menu, Rect *menuRectPtr, Point hitPt,
281 SInt16 *whichItem, TkMenu *menuPtr);
282 static void HandleMenuCalcItemMsg(MenuRef menu, Rect *menuRectPtr, Point hitPt,
283 SInt16 *whichItem, TkMenu *menuPtr);
284 static void AppearanceEntryDrawWrapper(TkMenuEntry *mePtr, Rect * menuRectPtr,
285 MenuTrackingData *mtdPtr, Drawable d, Tk_FontMetrics *fmPtr,
286 Tk_Font tkfont, int erase);
287 static pascal void ThemeMenuItemDrawingProc(const Rect *inBounds,
288 SInt16 inDepth, Boolean inIsColorDevice, SInt32 inUserData);
287 static void DrawMenuBackground(TkMenu *menuPtr, Rect *menuRectPtr,
288 Drawable d);
289 static void MenuDefProc(short message, MenuHandle menu,
290 Rect *menuRectPtr, Point hitPt, short *whichItem);
291 static void HandleMenuHiliteMsg(MenuRef menu, Rect *menuRectPtr,
292 Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
293 static void HandleMenuDrawMsg(MenuRef menu, Rect *menuRectPtr,
294 Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
295 static void HandleMenuFindItemMsg(MenuRef menu, Rect *menuRectPtr,
296 Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
297 static void HandleMenuPopUpMsg(MenuRef menu, Rect *menuRectPtr,
298 Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
299 static void HandleMenuCalcItemMsg(MenuRef menu, Rect *menuRectPtr,
300 Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
301 static void AppearanceEntryDrawWrapper(TkMenuEntry *mePtr,
302 Rect *menuRectPtr, MenuTrackingData *mtdPtr,
303 Drawable d, Tk_FontMetrics *fmPtr, Tk_Font tkfont,
304 int erase);
305 static pascal void ThemeMenuItemDrawingProc(const Rect *inBounds,
306 SInt16 inDepth, Boolean inIsColorDevice,
307 SInt32 inUserData);
289308 #else /* USE_TK_MDEF */
290309 # define useMDEF 0
291310 #endif /* USE_TK_MDEF */
292311
293312 #define IS_THEME_MENU_FONT(tkfont) (strcmp(Tk_NameOfFont(tkfont), "menu") == 0)
294
295313
296314 /*
297315 *----------------------------------------------------------------------
331349 * first determine the baseline of the text and then adjust the bounds
332350 * rect so the baseline aligns with the overall baseline of the menu item.
333351 */
352
334353 if (font == kThemeMenuItemCmdKeyFont) {
335354 Point size;
336355 SInt16 cmdKeyBaseline;
373392 Point pt;
374393
375394 ChkErr(GetThemeTextDimensions, string, font, kThemeStateActive, false, &pt,
376 NULL);
395 NULL);
377396 return pt.h;
378397 }
379398
387406 * level. See TkMacOSXGetNewMenuID for more information.
388407 *
389408 * Results:
390 * Returns TCL_OK if the id was not in use. Returns TCL_ERROR if the
391 * id was in use.
392 *
393 * Side effects:
394 * A hash table entry in the command table is created with a NULL
395 * value.
409 * Returns TCL_OK if the id was not in use. Returns TCL_ERROR if the id
410 * was in use.
411 *
412 * Side effects:
413 * A hash table entry in the command table is created with a NULL value.
396414 *
397415 *----------------------------------------------------------------------
398416 */
420438 *
421439 * TkMacOSXGetNewMenuID --
422440 *
423 * Allocates a new menu id and marks it in use. Each menu on the
424 * mac must be designated by a unique id, which is a short. In
425 * addition, some ids are reserved by the system. Since Tk uses
426 * mostly dynamic menus, we must allocate and free these ids on
427 * the fly. We use the id as a key into a hash table; if there
428 * is no hash entry, we know that we can use the id.
429 *
430 * Carbon allows a much larger number of menus than the old APIs.
431 * I believe this is 32768, but am not sure. This code just uses
432 * 2000 as the upper limit. Unfortunately tk leaks menus when
433 * cloning, under some circumstances (see bug on sourceforge).
434 *
435 * Results:
436 * Returns TCL_OK if succesful; TCL_ERROR if there are no more
437 * ids of the appropriate type to allocate. menuIDPtr contains
438 * the new id if succesful.
439 *
440 * Side effects:
441 * An entry is created for the menu in the command hash table,
442 * and the hash entry is stored in the appropriate field in the
443 * menu data structure.
441 * Allocates a new menu id and marks it in use. Each menu on the mac must
442 * be designated by a unique id, which is a short. In addition, some ids
443 * are reserved by the system. Since Tk uses mostly dynamic menus, we
444 * must allocate and free these ids on the fly. We use the id as a key
445 * into a hash table; if there is no hash entry, we know that we can use
446 * the id.
447 *
448 * Carbon allows a much larger number of menus than the old APIs. I
449 * believe this is 32768, but am not sure. This code just uses 2000 as
450 * the upper limit. Unfortunately tk leaks menus when cloning, under some
451 * circumstances (see bug on sourceforge).
452 *
453 * Results:
454 * Returns TCL_OK if succesful; TCL_ERROR if there are no more ids of the
455 * appropriate type to allocate. menuIDPtr contains the new id if
456 * succesful.
457 *
458 * Side effects:
459 * An entry is created for the menu in the command hash table, and the
460 * hash entry is stored in the appropriate field in the menu data
461 * structure.
444462 *
445463 *----------------------------------------------------------------------
446464 */
459477 short returnID = *menuIDPtr;
460478
461479 /*
462 * The following code relies on shorts and unsigned chars wrapping
463 * when the highest value is incremented. Also, the values between
464 * 236 and 255 inclusive are reserved for DA's by the Mac OS.
480 * The following code relies on shorts and unsigned chars wrapping when
481 * the highest value is incremented. Also, the values between 236 and 255
482 * inclusive are reserved for DA's by the Mac OS.
465483 */
466484
467485 if (!cascade) {
487505 }
488506 } else {
489507 /*
490 * Cascade ids must be between 0 and 235 only, so they must be
491 * dealt with separately.
508 * Cascade ids must be between 0 and 235 only, so they must be dealt
509 * with separately.
492510 */
493511
494512 short curID = lastCascadeID + 1;
562580 *
563581 * MenuPtrForMenuRef --
564582 *
565 * Returns a pointer to the TkMenu corresponding to a given
566 * Carbon MenuRef.
583 * Returns a pointer to the TkMenu corresponding to a given Carbon
584 * MenuRef.
567585 *
568586 * Results:
569587 * Returns a pointer to a TkMenu or NULL.
574592 *----------------------------------------------------------------------
575593 */
576594
577 TkMenu*
595 TkMenu *
578596 MenuPtrForMenuRef(
579597 MenuRef menu)
580598 {
581599 TkMenu *menuPtr = NULL;
582600 MenuID menuID = GetMenuID(menu);
583 Tcl_HashEntry *commandEntryPtr = Tcl_FindHashEntry(&commandTable,
584 (char*)(intptr_t)menuID);
601 Tcl_HashEntry *commandEntryPtr =
602 Tcl_FindHashEntry(&commandTable, (char*)(intptr_t)menuID);
585603
586604 if (commandEntryPtr) {
587 menuPtr = (TkMenu *) Tcl_GetHashValue(commandEntryPtr);
605 menuPtr = Tcl_GetHashValue(commandEntryPtr);
588606 }
589607 return menuPtr;
590608 }
636654 * Returns a standard TCL error.
637655 *
638656 * Side effects:
639 * Allocates a Macintosh menu handle and puts in the platformData
640 * field of the menuPtr.
657 * Allocates a Macintosh menu handle and puts in the platformData field
658 * of the menuPtr.
641659 *
642660 *----------------------------------------------------------------------
643661 */
722740 }
723741
724742 menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
725 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) menuPtr);
743 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, menuPtr);
726744 return TCL_OK;
727745 }
728746
749767 MenuRef macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
750768
751769 if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
752 Tcl_CancelIdleCall(ReconfigureMacintoshMenu, (ClientData) menuPtr);
770 Tcl_CancelIdleCall(ReconfigureMacintoshMenu, menuPtr);
753771 menuPtr->menuFlags &= ~MENU_RECONFIGURE_PENDING;
754772 }
755773 if (GetMenuID(macMenuHdl) == currentHelpMenuID) {
795813
796814 int
797815 SetMenuCascade(
798 TkMenu* menuPtr) /* The menu we are setting up to be a
816 TkMenu *menuPtr) /* The menu we are setting up to be a
799817 * cascade. */
800818 {
801819 MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
838856 if ((menuPtr->platformData != NULL)
839857 && !(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
840858 menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
841 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) menuPtr);
859 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, menuPtr);
842860 }
843861 }
844862
848866 * GetEntryText --
849867 *
850868 * Given a menu entry, gives back the text that should go in it.
851 * Separators should be done by the caller, as they have to be
852 * handled specially. This is primarily used to do a substitution
853 * between "..." and the ellipsis character which looks nicer.
869 * Separators should be done by the caller, as they have to be handled
870 * specially. This is primarily used to do a substitution between "..."
871 * and the ellipsis character which looks nicer.
854872 *
855873 * Results:
856874 * itemText points to the new text for the item.
914932 *
915933 * FindMarkCharacter --
916934 *
917 * Finds the Macintosh mark character based on the font of the
918 * item. We calculate a good mark character based on the font
919 * that this item is rendered in.
935 * Finds the Macintosh mark character based on the font of the item. We
936 * calculate a good mark character based on the font that this item is
937 * rendered in.
920938 *
921939 * Results:
922940 * Mark char.
956974 *
957975 * GetUtfMarkCharacter --
958976 *
959 * Get the utf8 string for the given mark character, taking into
960 * account the special menu font char codes.
977 * Get the utf8 string for the given mark character, taking into account
978 * the special menu font char codes.
961979 *
962980 * Results:
963981 * Length of returned utf8 string.
10801098 * Processes configurations for menu entries.
10811099 *
10821100 * Results:
1083 * Returns standard TCL result. If TCL_ERROR is returned, then
1084 * the interp's result contains an error message.
1085 *
1086 * Side effects:
1087 * Configuration information get set for mePtr; old resources
1088 * get freed, if any need it.
1101 * Returns standard TCL result. If TCL_ERROR is returned, then the
1102 * interp's result contains an error message.
1103 *
1104 * Side effects:
1105 * Configuration information get set for mePtr; old resources get freed,
1106 * if any need it.
10891107 *
10901108 *----------------------------------------------------------------------
10911109 */
10921110
10931111 int
10941112 TkpConfigureMenuEntry(
1095 TkMenuEntry *mePtr) /* Information about menu entry; may
1096 * or may not already have values for
1097 * some fields. */
1113 TkMenuEntry *mePtr) /* Information about menu entry; may or may
1114 * not already have values for some fields. */
10981115 {
10991116 TkMenu *menuPtr = mePtr->menuPtr;
11001117 EntryGeometry *geometryPtr = (EntryGeometry *) mePtr->platformEntryData;
11011118
11021119 /*
1103 * Cascade menus have to have menu IDs of less than 256. So
1104 * we need to change the child menu if this has been configured
1105 * for a cascade item.
1120 * Cascade menus have to have menu IDs of less than 256. So we need to
1121 * change the child menu if this has been configured for a cascade item.
11061122 */
11071123
11081124 if (mePtr->type == CASCADE_ENTRY) {
11341150 }
11351151
11361152 /*
1137 * We need to parse the accelerator string. If it has the strings
1138 * for Command, Control, Shift or Option, we need to flag it
1139 * so we can draw the symbols for it. We also need to precalcuate
1140 * the position of the first real character we are drawing.
1153 * We need to parse the accelerator string. If it has the strings for
1154 * Command, Control, Shift or Option, we need to flag it so we can draw
1155 * the symbols for it. We also need to precalcuate the position of the
1156 * first real character we are drawing.
11411157 */
11421158
11431159 if (0 == mePtr->accelLength) {
11561172
11571173 if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
11581174 menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
1159 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) menuPtr);
1175 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, menuPtr);
11601176 }
11611177
11621178 return TCL_OK;
11671183 *
11681184 * ReconfigureIndividualMenu --
11691185 *
1170 * This routine redoes the guts of the menu. It works from
1171 * a base item and offset, so that a regular menu will
1172 * just have all of its items added, but the help menu will
1173 * have all of its items appended after the apple-defined
1174 * items.
1186 * This routine redoes the guts of the menu. It works from a base item
1187 * and offset, so that a regular menu will just have all of its items
1188 * added, but the help menu will have all of its items appended after the
1189 * apple-defined items.
11751190 *
11761191 * Results:
11771192 * None.
11851200 void
11861201 ReconfigureIndividualMenu(
11871202 TkMenu *menuPtr, /* The menu we are affecting. */
1188 MenuHandle macMenuHdl, /* The macintosh menu we are affecting.
1189 * Will not necessarily be
1190 * menuPtr->platformData because this could
1191 * be the help menu. */
1192 int base) /* The last index that we do not want
1193 * touched. 0 for normal menus;
1194 * # of system help menu items
1195 * for help menus. */
1203 MenuHandle macMenuHdl, /* The macintosh menu we are affecting. Will
1204 * not necessarily be menuPtr->platformData
1205 * because this could be the help menu. */
1206 int base) /* The last index that we do not want touched.
1207 * 0 for normal menus; # of system help menu
1208 * items for help menus. */
11961209 {
11971210 int count;
11981211 int index;
12051218 */
12061219
12071220 TkMacOSXInitNamedDebugSymbol(HIToolbox, void, DebugPrintMenu,
1208 MenuRef menu);
1221 MenuRef menu);
12091222 if (DebugPrintMenu) {
12101223 DebugPrintMenu(macMenuHdl);
12111224 }
12311244 mePtr = menuPtr->entries[index - 1];
12321245
12331246 /*
1234 * We have to do separators separately because SetMenuItemText
1235 * does not parse meta-characters.
1247 * We have to do separators separately because SetMenuItemText does
1248 * not parse meta-characters.
12361249 */
12371250
12381251 if (mePtr->type == SEPARATOR_ENTRY) {
12501263 CFRelease(cfStr);
12511264 } else {
12521265 AppendMenuItemTextWithCFString(macMenuHdl, CFSTR ("<Error>"),
1253 0, 0, NULL);
1266 0, 0, NULL);
12541267 }
12551268 Tcl_DStringFree(&itemTextDString);
12561269
12721285 if ((mePtr->type == CHECK_BUTTON_ENTRY)
12731286 || (mePtr->type == RADIO_BUTTON_ENTRY)) {
12741287 CheckMenuItem(macMenuHdl, base + index, (mePtr->entryFlags
1275 & ENTRY_SELECTED) && mePtr->indicatorOn);
1288 & ENTRY_SELECTED) && mePtr->indicatorOn);
12761289 if (mePtr->indicatorOn
12771290 && (mePtr->entryFlags & ENTRY_SELECTED)) {
12781291 SetItemMark(macMenuHdl, base + index,
12911304 ChkErr(SetMenuItemHierarchicalID, macMenuHdl,
12921305 base + index, GetMenuID(childMenuHdl));
12931306 }
1307
12941308 /*
12951309 * If we changed the highligthing of this menu, its
1296 * children all have to be reconfigured so that
1297 * their state will be reflected in the menubar.
1310 * children all have to be reconfigured so that their
1311 * state will be reflected in the menubar.
12981312 */
12991313
13001314 if (!(mePtr->childMenuRefPtr->menuPtr->menuFlags
1301 & MENU_RECONFIGURE_PENDING)) {
1315 & MENU_RECONFIGURE_PENDING)) {
13021316 mePtr->childMenuRefPtr->menuPtr->menuFlags
13031317 |= MENU_RECONFIGURE_PENDING;
13041318 Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
1305 (ClientData) mePtr->childMenuRefPtr->menuPtr);
1319 mePtr->childMenuRefPtr->menuPtr);
13061320 }
13071321 }
13081322 }
13091323
13101324 if ((mePtr->type != CASCADE_ENTRY) && (mePtr->accelPtr != NULL)) {
13111325 int accelLen, modifiers = 0, hasCmd = 0;
1312 EntryGeometry *geometryPtr =
1313 (EntryGeometry*)mePtr->platformEntryData;
1326 EntryGeometry *geometryPtr = (EntryGeometry *)
1327 mePtr->platformEntryData;
13141328 int offset = geometryPtr->accelTextStart;
13151329 char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, &accelLen);
13161330
13401354 /*
13411355 * Convert from accelerator names to Carbon menu glyphs.
13421356 */
1357
13431358 struct Glyph {
13441359 const char *name;
13451360 const size_t len;
14171432 *
14181433 * ReconfigureMacintoshMenu --
14191434 *
1420 * Rebuilds the Macintosh MenuHandle items from the menu. Called
1421 * usually as an idle handler, but can be called synchronously
1422 * if the menu is about to be posted.
1423 *
1424 * Results:
1425 * None.
1426 *
1427 * Side effects:
1428 * Configuration information get set for mePtr; old resources
1429 * get freed, if any need it.
1435 * Rebuilds the Macintosh MenuHandle items from the menu. Called usually
1436 * as an idle handler, but can be called synchronously if the menu is
1437 * about to be posted.
1438 *
1439 * Results:
1440 * None.
1441 *
1442 * Side effects:
1443 * Configuration information get set for mePtr; old resources get freed,
1444 * if any need it.
14301445 *
14311446 *----------------------------------------------------------------------
14321447 */
14331448
14341449 void
14351450 ReconfigureMacintoshMenu(
1436 ClientData clientData) /* Information about menu entry; may
1437 * or may not already have values for
1438 * some fields. */
1439 {
1440 TkMenu *menuPtr = (TkMenu *) clientData;
1451 ClientData clientData) /* Information about menu entry; may or may
1452 * not already have values for some fields. */
1453 {
1454 TkMenu *menuPtr = clientData;
14411455 MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
14421456 MenuHandle helpMenuHdl = NULL;
14431457
14511465
14521466 if (GetMenuID(macMenuHdl) == currentHelpMenuID) {
14531467 MenuItemIndex helpIndex;
1468
14541469 HMGetHelpMenu(&helpMenuHdl,&helpIndex);
14551470 if (helpMenuHdl != NULL) {
14561471 ReconfigureIndividualMenu(menuPtr, helpMenuHdl, helpIndex - 1);
14701485 *
14711486 * CompleteIdlers --
14721487 *
1473 * Completes all idle handling so that the menus are in sync when
1474 * the user invokes them with the mouse.
1488 * Completes all idle handling so that the menus are in sync when the
1489 * user invokes them with the mouse.
14751490 *
14761491 * Results:
14771492 * None.
14891504 int i;
14901505
14911506 if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
1492 Tcl_CancelIdleCall(ReconfigureMacintoshMenu, (ClientData) menuPtr);
1493 ReconfigureMacintoshMenu((ClientData) menuPtr);
1507 Tcl_CancelIdleCall(ReconfigureMacintoshMenu, menuPtr);
1508 ReconfigureMacintoshMenu(menuPtr);
14941509 }
14951510
14961511 for (i = 0; i < menuPtr->numEntries; i++) {
15421557
15431558 inPostMenu++;
15441559 result = TkPreprocessMenu(menuPtr);
1560
15451561 /*
1546 * The post commands could have deleted the menu, which means
1547 * we are dead and should go away.
1562 * The post commands could have deleted the menu, which means we are
1563 * dead and should go away.
15481564 */
15491565
15501566 if (result != TCL_OK || !menuPtr->tkwin) {
15911607 * TkpMenuNewEntry --
15921608 *
15931609 * Adds a pointer to a new menu entry structure with the platform-
1594 * specific fields filled in. The Macintosh uses the
1595 * platformEntryData field of the TkMenuEntry record to store
1596 * geometry information.
1610 * specific fields filled in. The Macintosh uses the platformEntryData
1611 * field of the TkMenuEntry record to store geometry information.
15971612 *
15981613 * Results:
15991614 * Standard TCL error.
16091624 TkpMenuNewEntry(
16101625 TkMenuEntry *mePtr) /* The menu we are adding an entry to */
16111626 {
1612 EntryGeometry *geometryPtr =
1613 (EntryGeometry *) ckalloc(sizeof(EntryGeometry));
1627 EntryGeometry *geometryPtr = (EntryGeometry *)
1628 ckalloc(sizeof(EntryGeometry));
16141629 TkMenu *menuPtr = mePtr->menuPtr;
16151630
16161631 geometryPtr->accelTextStart = 0;
16221637 mePtr->platformEntryData = (TkMenuPlatformEntryData) geometryPtr;
16231638 if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
16241639 menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
1625 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) menuPtr);
1640 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, menuPtr);
16261641 }
16271642 return TCL_OK;
16281643 }
16911706 if (currentAppleMenuID != 0) {
16921707 hashEntryPtr = Tcl_FindHashEntry(&commandTable,
16931708 (char*)(intptr_t)currentAppleMenuID);
1694 appleMenuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
1709 appleMenuPtr = Tcl_GetHashValue(hashEntryPtr);
16951710 TkpDestroyMenu(appleMenuPtr);
16961711 TkpNewMenu(appleMenuPtr);
16971712 appleMenuPtr->menuFlags &= ~MENU_APPLE_MENU;
16981713 appleMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
1699 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, (ClientData) appleMenuPtr);
1714 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, appleMenuPtr);
17001715 }
17011716
17021717 if (currentHelpMenuID != 0) {
17031718 hashEntryPtr = Tcl_FindHashEntry(&commandTable,
17041719 (char*)(intptr_t)currentHelpMenuID);
1705 helpMenuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr);
1720 helpMenuPtr = Tcl_GetHashValue(hashEntryPtr);
17061721 TkpDestroyMenu(helpMenuPtr);
17071722 TkpNewMenu(helpMenuPtr);
17081723 helpMenuPtr->menuFlags &= ~MENU_HELP_MENU;
17091724 helpMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
1710 Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
1711 (ClientData) helpMenuPtr);
1725 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, helpMenuPtr);
17121726 }
17131727
17141728 /*
1715 * We need to find the clone of this menu that is the menubar.
1716 * Once we do that, for every cascade in the menu, we need to
1717 * insert the Mac menu in the Mac menubar. Finally, we need
1718 * to redraw the menubar.
1729 * We need to find the clone of this menu that is the menubar. Once we do
1730 * that, for every cascade in the menu, we need to insert the Mac menu in
1731 * the Mac menubar. Finally, we need to redraw the menubar.
17191732 */
17201733
17211734 menuRefPtr = NULL;
18081821 TkMacOSXGetNewMenuID(appleMenuPtr->interp, appleMenuPtr, 0,
18091822 &appleID);
18101823 macMenuHdl = NewMenu(appleID, "\p\024");
1811 appleMenuPtr->platformData =
1812 (TkMenuPlatformData) ckalloc(sizeof(MacMenu));
1824 appleMenuPtr->platformData = (TkMenuPlatformData)
1825 ckalloc(sizeof(MacMenu));
18131826 ((MacMenu *)appleMenuPtr->platformData)->menuHdl
18141827 = macMenuHdl;
18151828 appleMenuPtr->menuFlags |= MENU_APPLE_MENU;
18161829 if (!(appleMenuPtr->menuFlags
18171830 & MENU_RECONFIGURE_PENDING)) {
18181831 appleMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
1819 Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
1820 (ClientData) appleMenuPtr);
1832 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, appleMenuPtr);
18211833 }
18221834 InsertMenu(macMenuHdl, 0);
18231835 RecursivelyInsertMenu(appleMenuPtr);
18521864 & MENU_RECONFIGURE_PENDING)) {
18531865 helpMenuPtr->menuFlags
18541866 |= MENU_RECONFIGURE_PENDING;
1855 Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
1856 (ClientData) helpMenuPtr);
1867 Tcl_DoWhenIdle(ReconfigureMacintoshMenu, helpMenuPtr);
18571868 }
18581869 macMenuHdl =
18591870 ((MacMenu *) helpMenuPtr->platformData)->menuHdl;
19091920
19101921 void
19111922 RecursivelyInsertMenu(
1912 TkMenu *menuPtr) /* All of the cascade items in this menu
1913 * will be inserted into the mac menubar. */
1923 TkMenu *menuPtr) /* All of the cascade items in this menu will
1924 * be inserted into the mac menubar. */
19141925 {
19151926 int i;
19161927 TkMenu *cascadeMenuPtr;
19491960
19501961 void
19511962 RecursivelyDeleteMenu(
1952 TkMenu *menuPtr) /* All of the cascade items in this menu
1953 * will be deleted from the mac menubar. */
1963 TkMenu *menuPtr) /* All of the cascade items in this menu will
1964 * be deleted from the mac menubar. */
19541965 {
19551966 int i;
19561967 TkMenu *cascadeMenuPtr;
20092020 *
20102021 * TkpSetMainMenubar --
20112022 *
2012 * Puts the menu associated with a window into the menubar. Should
2013 * only be called when the window is in front.
2023 * Puts the menu associated with a window into the menubar. Should only
2024 * be called when the window is in front.
20142025 *
20152026 * Results:
20162027 * None.
20252036 TkpSetMainMenubar(
20262037 Tcl_Interp *interp, /* The interpreter of the application */
20272038 Tk_Window tkwin, /* The frame we are setting up */
2028 char *menuName) /* The name of the menu to put in front.
2029 * If NULL, use the default menu bar.
2030 */
2039 char *menuName) /* The name of the menu to put in front. If
2040 * NULL, use the default menu bar. */
20312041 {
20322042 TkWindow *winPtr = (TkWindow *) tkwin;
20332043 WindowRef macWindowPtr;
21062116 * None.
21072117 *
21082118 * Side effects:
2109 * On Windows and UNIX, associates the platform menu with the
2110 * platform window.
2119 * On Windows and UNIX, associates the platform menu with the platform
2120 * window.
21112121 *
21122122 *----------------------------------------------------------------------
21132123 */
21542164 *
21552165 * EventuallyInvokeMenu --
21562166 *
2157 * This IdleTime callback actually invokes the menu command
2158 * scheduled in TkMacOSXDispatchMenuEvent.
2167 * This IdleTime callback actually invokes the menu command scheduled in
2168 * TkMacOSXDispatchMenuEvent.
21592169 *
21602170 * Results:
21612171 * None.
21702180 EventuallyInvokeMenu (
21712181 ClientData data)
21722182 {
2173 struct MenuCommandHandlerData *realData =
2174 (struct MenuCommandHandlerData *) data;
2183 struct MenuCommandHandlerData *realData = data;
21752184 int code;
21762185
21772186 code = TkInvokeMenu(realData->menuPtr->interp, realData->menuPtr,
21792188
21802189 if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) {
21812190 Tcl_AddErrorInfo(realData->menuPtr->interp, "\n (menu invoke)");
2182 Tcl_BackgroundError(realData->menuPtr->interp);
2191 Tcl_BackgroundException(realData->menuPtr->interp, code);
21832192 }
21842193
21852194 if (realData->menuPtr->tkwin) {
21962205 *
21972206 * TkMacOSXDispatchMenuEvent --
21982207 *
2199 * Given a menu id and an item, dispatches the command associated
2200 * with it.
2208 * Given a menu id and an item, dispatches the command associated with
2209 * it.
22012210 *
22022211 * Results:
22032212 * None.
22482257 && (index > menuPtr->numEntries + 1)) {
22492258 /*
22502259 * We don't need to do anything here, the standard
2251 * Application event handler will open the built-in
2252 * Apple menu item for us.
2260 * Application event handler will open the built-in Apple
2261 * menu item for us.
22532262 */
2263
22542264 result = TCL_OK;
22552265 } else {
2256 struct MenuCommandHandlerData *data
2257 = (struct MenuCommandHandlerData *)
2266 struct MenuCommandHandlerData *data =
2267 (struct MenuCommandHandlerData *)
22582268 ckalloc(sizeof(struct MenuCommandHandlerData));
22592269
22602270 Tcl_Preserve(menuPtr->interp);
22612271 Tcl_Preserve(menuPtr);
22622272 data->menuPtr = menuPtr;
22632273 data->index = index - 1;
2264 Tcl_DoWhenIdle(EventuallyInvokeMenu,
2265 (ClientData) data);
2274 Tcl_DoWhenIdle(EventuallyInvokeMenu, data);
22662275 /* result = TkInvokeMenu(menuPtr->interp, menuPtr, index - 1); */
22672276 }
22682277 } else {
25072516 encoding = kTextEncodingMacKeyboardGlyphs;
25082517 }
25092518 switch (mePtr->state) {
2510 case ENTRY_ACTIVE:
2511 drawState = kThemeStatePressed;
2512 break;
2513 case ENTRY_DISABLED:
2514 drawState = kThemeStateInactive;
2515 break;
2516 default:
2517 drawState = kThemeStateActive;
2518 break;
2519 case ENTRY_ACTIVE:
2520 drawState = kThemeStatePressed;
2521 break;
2522 case ENTRY_DISABLED:
2523 drawState = kThemeStateInactive;
2524 break;
2525 default:
2526 drawState = kThemeStateActive;
2527 break;
25192528 }
25202529 cfStr = CFStringCreateWithBytes(NULL, (UInt8*)&mark, 1,
25212530 encoding, false);
25482557 * Nothing
25492558 *
25502559 * Side effects:
2551 * Commands are output to X to display the menu in its
2552 * current mode.
2553 *
2554 *----------------------------------------------------------------------
2555 */
2560 * Commands are output to X to display the menu in its current mode.
2561 *
2562 *----------------------------------------------------------------------
2563 */
2564
25562565 void
25572566 DrawMenuBackground(
25582567 TkMenu *menuPtr,
2559 Rect *menuRectPtr, /* The menu rect */
2568 Rect *menuRectPtr, /* The menu rect */
25602569 Drawable d) /* What we are drawing into */
25612570 {
25622571 Tk_3DBorder border;
25822591 * None.
25832592 *
25842593 * Side effects:
2585 * Commands are output to X to display the menu in its
2586 * current mode.
2594 * Commands are output to X to display the menu in its current mode.
25872595 *
25882596 *----------------------------------------------------------------------
25892597 */
26152623 ThemeDrawState drawState;
26162624
26172625 switch (mePtr->state) {
2618 case ENTRY_ACTIVE:
2619 drawState = kThemeStatePressed;
2620 break;
2621 case ENTRY_DISABLED:
2622 drawState = kThemeStateInactive;
2623 break;
2624 default:
2625 drawState = kThemeStateActive;
2626 break;
2626 case ENTRY_ACTIVE:
2627 drawState = kThemeStatePressed;
2628 break;
2629 case ENTRY_DISABLED:
2630 drawState = kThemeStateInactive;
2631 break;
2632 default:
2633 drawState = kThemeStateActive;
2634 break;
26272635 }
26282636 if ((mePtr->entryFlags & ENTRY_ACCEL_MASK) == 0) {
26292637 leftEdge -= geometryPtr->modifierWidth;
26762684 * None.
26772685 *
26782686 * Side effects:
2679 * Commands are output to X to display the menu in its
2680 * current mode.
2687 * Commands are output to X to display the menu in its current mode.
26812688 *
26822689 *----------------------------------------------------------------------
26832690 */
27142721 *
27152722 * AppearanceEntryDrawWrapper --
27162723 *
2717 * It routes to the Appearance Managers DrawThemeEntry, which will
2718 * then call us back after setting up the drawing context.
2724 * It routes to the Appearance Managers DrawThemeEntry, which will then
2725 * call us back after setting up the drawing context.
27192726 *
27202727 * Results:
27212728 * A menu entry is drawn
27252732 *
27262733 *----------------------------------------------------------------------
27272734 */
2735
27282736 void
27292737 AppearanceEntryDrawWrapper(
27302738 TkMenuEntry *mePtr,
27752783 DrawMenuBackground(mePtr->menuPtr, &itemRect, d);
27762784 }
27772785 DrawThemeMenuItem(menuRectPtr, &itemRect,
2778 mtdPtr->virtualMenuTop, mtdPtr->virtualMenuBottom, theState,
2779 theType | kThemeMenuItemNoBackground, tkThemeMenuItemDrawingUPP,
2780 (unsigned long) &meData);
2786 mtdPtr->virtualMenuTop, mtdPtr->virtualMenuBottom, theState,
2787 theType | kThemeMenuItemNoBackground, tkThemeMenuItemDrawingUPP,
2788 (unsigned long) &meData);
27812789 if (erase) {
27822790 EnableScreenUpdates();
27832791 }
27982806 *
27992807 *----------------------------------------------------------------------
28002808 */
2809
28012810 pascal void
28022811 ThemeMenuItemDrawingProc(
28032812 const Rect *inBounds,
28192828 *
28202829 * TkMacOSXHandleTearoffMenu() --
28212830 *
2822 * This routine sees if the MDEF has set a menu and a mouse position
2823 * for tearing off and makes a tearoff menu if it has.
2831 * This routine sees if the MDEF has set a menu and a mouse position for
2832 * tearing off and makes a tearoff menu if it has.
28242833 *
28252834 * Results:
28262835 * menuPtr->interp will have the result of the tearoff command.
28442853 *
28452854 * TkpInitializeMenuBindings --
28462855 *
2847 * For every interp, initializes the bindings for Windows
2848 * menus. Does nothing on Mac or XWindows.
2849 *
2850 * Results:
2851 * None.
2852 *
2853 * Side effects:
2854 * C-level bindings are setup for the interp which will
2855 * handle Alt-key sequences for menus without beeping
2856 * or interfering with user-defined Alt-key bindings.
2856 * For every interp, initializes the bindings for Windows menus. Does
2857 * nothing on Mac or XWindows.
2858 *
2859 * Results:
2860 * None.
2861 *
2862 * Side effects:
2863 * C-level bindings are setup for the interp which will handle Alt-key
2864 * sequences for menus without beeping or interfering with user-defined
2865 * Alt-key bindings.
28572866 *
28582867 *--------------------------------------------------------------
28592868 */
28742883 *
28752884 * TkpComputeMenubarGeometry --
28762885 *
2877 * This procedure is invoked to recompute the size and
2878 * layout of a menu that is a menubar clone.
2879 *
2880 * Results:
2881 * None.
2882 *
2883 * Side effects:
2884 * Fields of menu entries are changed to reflect their
2885 * current positions, and the size of the menu window
2886 * itself may be changed.
2886 * This procedure is invoked to recompute the size and layout of a menu
2887 * that is a menubar clone.
2888 *
2889 * Results:
2890 * None.
2891 *
2892 * Side effects:
2893 * Fields of menu entries are changed to reflect their current positions,
2894 * and the size of the menu window itself may be changed.
28872895 *
28882896 *--------------------------------------------------------------
28892897 */
29062914 * None.
29072915 *
29082916 * Side effects:
2909 * Commands are output to X to display the menu in its
2910 * current mode.
2917 * Commands are output to X to display the menu in its current mode.
29112918 *
29122919 *----------------------------------------------------------------------
29132920 */
29572964 *
29582965 * TkMacOSXSetHelpMenuItemCount --
29592966 *
2960 * Has to be called after the first call to InsertMenu. Sets
2961 * up the global variable for the number of items in the
2962 * unmodified help menu.
2963 * NB. Nobody uses this any more, since you can get the number
2964 * of system help items from HMGetHelpMenu trivially.
2965 * But it is in the stubs table...
2967 * Has to be called after the first call to InsertMenu. Sets up the
2968 * global variable for the number of items in the unmodified help menu.
2969 * NB. Nobody uses this any more, since you can get the number of system
2970 * help items from HMGetHelpMenu trivially. But it is in the stubs
2971 * table...
29662972 *
29672973 * Results:
29682974 * None.
30263032 *
30273033 * TkpDrawMenuEntry --
30283034 *
3029 * Draws the given menu entry at the given coordinates with the
3030 * given attributes.
3035 * Draws the given menu entry at the given coordinates with the given
3036 * attributes.
30313037 *
30323038 * Results:
30333039 * None.
30653071 int adjustedHeight = height - 2 * padY;
30663072
30673073 /*
3068 * Choose the gc for drawing the foreground part of the entry.
3069 * Under Appearance, we pass a null (appearanceGC) to tell
3070 * ourselves not to change whatever color the appearance manager has set.
3074 * Choose the gc for drawing the foreground part of the entry. Under
3075 * Appearance, we pass a null (appearanceGC) to tell ourselves not to
3076 * change whatever color the appearance manager has set.
30713077 */
30723078
30733079 if ((mePtr->state == ENTRY_ACTIVE) && !strictMotif) {
31183124 }
31193125
31203126 /*
3121 * Need to draw the entire background, including padding. On Unix,
3122 * for menubars, we have to draw the rest of the entry taking
3123 * into account the padding.
3127 * Need to draw the entire background, including padding. On Unix, for
3128 * menubars, we have to draw the rest of the entry taking into account the
3129 * padding.
31243130 */
31253131
31263132 DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder, bgBorder, x, y,
31493155 *
31503156 * TkpComputeStandardMenuGeometry --
31513157 *
3152 * This procedure is invoked to recompute the size and
3153 * layout of a menu that is not a menubar clone.
3154 *
3155 * Results:
3156 * None.
3157 *
3158 * Side effects:
3159 * Fields of menu entries are changed to reflect their
3160 * current positions, and the size of the menu window
3161 * itself may be changed.
3158 * This procedure is invoked to recompute the size and layout of a menu
3159 * that is not a menubar clone.
3160 *
3161 * Results:
3162 * None.
3163 *
3164 * Side effects:
3165 * Fields of menu entries are changed to reflect their current positions,
3166 * and the size of the menu window itself may be changed.
31623167 *
31633168 *--------------------------------------------------------------
31643169 */
31883193 &activeBorderWidth);
31893194 x = y = borderWidth;
31903195 indicatorSpace = labelWidth = accelWidth = maxAccelTextWidth = 0;
3191 windowHeight = windowWidth = maxWidth = lastColumnBreak = 0;
3192 maxModifierWidth = nonAccelMargin = maxNonAccelMargin = 0;
3196 windowHeight = maxWidth = lastColumnBreak = 0;
3197 maxModifierWidth = maxNonAccelMargin = 0;
31933198 maxEntryWithAccelWidth = maxEntryWithoutAccelWidth = 0;
31943199 maxIndicatorSpace = 0;
31953200
31963201 /*
3197 * On the Mac especially, getting font metrics can be quite slow,
3198 * so we want to do it intelligently. We are going to precalculate
3199 * them and pass them down to all of the measuring and drawing
3200 * routines. We will measure the font metrics of the menu once.
3201 * If an entry does not have its own font set, then we give
3202 * the geometry/drawing routines the menu's font and metrics.
3203 * If an entry has its own font, we will measure that font and
3204 * give all of the geometry/drawing the entry's font and metrics.
3202 * On the Mac especially, getting font metrics can be quite slow, so we
3203 * want to do it intelligently. We are going to precalculate them and pass
3204 * them down to all of the measuring and drawing routines. We will measure
3205 * the font metrics of the menu once. If an entry does not have its own
3206 * font set, then we give the geometry/drawing routines the menu's font
3207 * and metrics. If an entry has its own font, we will measure that font
3208 * and give all of the geometry/drawing the entry's font and metrics.
32053209 */
32063210
32073211 menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
32603264 lastColumnBreak = i;
32613265 y = borderWidth;
32623266 }
3263 geometryPtr = (EntryGeometry *) mePtr->platformEntryData;
3267 /*geometryPtr = (EntryGeometry *) mePtr->platformEntryData;*/ /* dead code */
32643268
32653269 if (mePtr->type == SEPARATOR_ENTRY) {
32663270 GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont,
32723276 mePtr->height = height;
32733277 } else {
32743278 /*
3275 * For each entry, compute the height required by that
3276 * particular entry, plus three widths: the width of the
3277 * label, the width to allow for an indicator to be displayed
3278 * to the left of the label (if any), and the width of the
3279 * accelerator to be displayed to the right of the label
3280 * (if any). These sizes depend, of course, on the type
3281 * of the entry.
3279 * For each entry, compute the height required by that particular
3280 * entry, plus three widths: the width of the label, the width to
3281 * allow for an indicator to be displayed to the left of the label
3282 * (if any), and the width of the accelerator to be displayed to
3283 * the right of the label (if any). These sizes depend, of course,
3284 * on the type of the entry.
32823285 */
32833286
32843287 GetMenuLabelGeometry(mePtr, tkfont, fmPtr, &labelWidth, &height);
33803383 windowHeight += borderWidth;
33813384
33823385 /*
3383 * The X server doesn't like zero dimensions, so round up to at least
3384 * 1 (a zero-sized menu should never really occur, anyway).
3386 * The X server doesn't like zero dimensions, so round up to at least 1 (a
3387 * zero-sized menu should never really occur, anyway).
33853388 */
33863389
33873390 if (windowWidth <= 0) {
34053408 * None.
34063409 *
34073410 * Side effects:
3408 * Commands are output to X to display the menu in its
3409 * current mode.
3411 * Commands are output to X to display the menu in its current mode.
34103412 *
34113413 *----------------------------------------------------------------------
34123414 */
34673469 int fullWidth = (imageWidth > textWidth ? imageWidth : textWidth);
34683470
34693471 switch ((enum compound) mePtr->compound) {
3470 case COMPOUND_TOP:
3471 textXOffset = (fullWidth - textWidth)/2;
3472 textYOffset = imageHeight/2 + 2;
3473 imageXOffset = (fullWidth - imageWidth)/2;
3474 imageYOffset = -textHeight/2;
3475 break;
3476 case COMPOUND_BOTTOM:
3477 textXOffset = (fullWidth - textWidth)/2;
3478 textYOffset = -imageHeight/2;
3479 imageXOffset = (fullWidth - imageWidth)/2;
3480 imageYOffset = textHeight/2 + 2;
3481 break;
3482 case COMPOUND_LEFT:
3483 /*
3484 * Position image in the indicator space to the left of the
3485 * entries, unless this entry is a radio|check button because
3486 * then the indicator space will be used.
3487 */
3488
3489 textXOffset = imageWidth + 2 - menuTextLeadingEdgeMargin;
3490 if ((mePtr->type != CHECK_BUTTON_ENTRY)
3491 && (mePtr->type != RADIO_BUTTON_ENTRY)) {
3492 textXOffset -= indicatorSpace;
3493 imageXOffset = -indicatorSpace;
3494 }
3495 if (textXOffset < 0) {
3496 textXOffset = 0;
3497 }
3498 break;
3499 case COMPOUND_RIGHT:
3500 imageXOffset = textWidth + 2 - menuTextTrailingEdgeMargin;
3501 break;
3502 case COMPOUND_CENTER:
3503 textXOffset = (fullWidth - textWidth)/2;
3504 imageXOffset = (fullWidth - imageWidth)/2;
3505 break;
3506 case COMPOUND_NONE:
3507 /*
3508 * Never reached.
3509 */
3510 break;
3472 case COMPOUND_TOP:
3473 textXOffset = (fullWidth - textWidth)/2;
3474 textYOffset = imageHeight/2 + 2;
3475 imageXOffset = (fullWidth - imageWidth)/2;
3476 imageYOffset = -textHeight/2;
3477 break;
3478 case COMPOUND_BOTTOM:
3479 textXOffset = (fullWidth - textWidth)/2;
3480 textYOffset = -imageHeight/2;
3481 imageXOffset = (fullWidth - imageWidth)/2;
3482 imageYOffset = textHeight/2 + 2;
3483 break;
3484 case COMPOUND_LEFT:
3485 /*
3486 * Position image in the indicator space to the left of the
3487 * entries, unless this entry is a radio|check button because then
3488 * the indicator space will be used.
3489 */
3490
3491 textXOffset = imageWidth + 2 - menuTextLeadingEdgeMargin;
3492 if ((mePtr->type != CHECK_BUTTON_ENTRY)
3493 && (mePtr->type != RADIO_BUTTON_ENTRY)) {
3494 textXOffset -= indicatorSpace;
3495 imageXOffset = -indicatorSpace;
3496 }
3497 if (textXOffset < 0) {
3498 textXOffset = 0;
3499 }
3500 break;
3501 case COMPOUND_RIGHT:
3502 imageXOffset = textWidth + 2 - menuTextTrailingEdgeMargin;
3503 break;
3504 case COMPOUND_CENTER:
3505 textXOffset = (fullWidth - textWidth)/2;
3506 imageXOffset = (fullWidth - imageWidth)/2;
3507 break;
3508 case COMPOUND_NONE:
3509 /*
3510 * Never reached.
3511 */
3512 break;
35113513 }
35123514 }
35133515
35613563 *
35623564 * DrawMenuEntryBackground --
35633565 *
3564 * This procedure draws the background part of a menu entry.
3565 * Under Appearance, we only draw the background if the entry's
3566 * border is set, we DO NOT inherit it from the menu...
3567 *
3568 * Results:
3569 * None.
3570 *
3571 * Side effects:
3572 * Commands are output to X to display the menu in its
3573 * current mode.
3566 * This procedure draws the background part of a menu entry. Under
3567 * Appearance, we only draw the background if the entry's border is set,
3568 * we DO NOT inherit it from the menu...
3569 *
3570 * Results:
3571 * None.
3572 *
3573 * Side effects:
3574 * Commands are output to X to display the menu in its current mode.
35743575 *
35753576 *----------------------------------------------------------------------
35763577 */
36553656 switch ((enum compound) mePtr->compound) {
36563657 int margin;
36573658
3658 case COMPOUND_TOP:
3659 case COMPOUND_BOTTOM:
3660 if (textWidth > *widthPtr) {
3661 *widthPtr = textWidth;
3662 }
3663 *heightPtr += textHeight + 2;
3664 break;
3665 case COMPOUND_LEFT:
3666 margin = *widthPtr + 2;
3667 if (margin > menuTextLeadingEdgeMargin) {
3668 margin = menuTextLeadingEdgeMargin;
3669 }
3670 *widthPtr += textWidth + 2 - margin;
3671 if (textHeight > *heightPtr) {
3672 *heightPtr = textHeight;
3673 }
3674 break;
3675 case COMPOUND_RIGHT:
3676 margin = menuTextTrailingEdgeMargin;
3677 *widthPtr += textWidth + 2 - margin;
3678 if (textHeight > *heightPtr) {
3679 *heightPtr = textHeight;
3680 }
3681 break;
3682 case COMPOUND_CENTER:
3683 if (textWidth > *widthPtr) {
3684 *widthPtr = textWidth;
3685 }
3686 if (textHeight > *heightPtr) {
3687 *heightPtr = textHeight;
3688 }
3689 break;
3690 case COMPOUND_NONE:
3691 /*
3692 * Never reached.
3693 */
3694 break;
3659 case COMPOUND_TOP:
3660 case COMPOUND_BOTTOM:
3661 if (textWidth > *widthPtr) {
3662 *widthPtr = textWidth;
3663 }
3664 *heightPtr += textHeight + 2;
3665 break;
3666 case COMPOUND_LEFT:
3667 margin = *widthPtr + 2;
3668 if (margin > menuTextLeadingEdgeMargin) {
3669 margin = menuTextLeadingEdgeMargin;
3670 }
3671 *widthPtr += textWidth + 2 - margin;
3672 if (textHeight > *heightPtr) {
3673 *heightPtr = textHeight;
3674 }
3675 break;
3676 case COMPOUND_RIGHT:
3677 margin = menuTextTrailingEdgeMargin;
3678 *widthPtr += textWidth + 2 - margin;
3679 if (textHeight > *heightPtr) {
3680 *heightPtr = textHeight;
3681 }
3682 break;
3683 case COMPOUND_CENTER:
3684 if (textWidth > *widthPtr) {
3685 *widthPtr = textWidth;
3686 }
3687 if (textHeight > *heightPtr) {
3688 *heightPtr = textHeight;
3689 }
3690 break;
3691 case COMPOUND_NONE:
3692 /*
3693 * Never reached.
3694 */
3695 break;
36953696 }
36963697 goto labelGeomDone;
36973698 }
37003701 *heightPtr = textHeight;
37013702 }
37023703
3703 labelGeomDone:
3704 labelGeomDone:
37043705 *heightPtr += menuItemExtraHeight;
37053706 *widthPtr += menuItemExtraWidth;
37063707 }
37833784 *
37843785 * MenuSelectEvent --
37853786 *
3786 * Generates a "MenuSelect" virtual event. This can be used to
3787 * do context-sensitive menu help.
3787 * Generates a "MenuSelect" virtual event. This can be used to do
3788 * context-sensitive menu help.
37883789 *
37893790 * Results:
37903791 * None.
39243925 * TkpMenuNotifyToplevelCreate --
39253926 *
39263927 * This routine reconfigures the menu and the clones indicated by
3927 * menuName becuase a toplevel has been created and any system
3928 * menus need to be created. Only applicable to Windows.
3928 * menuName becuase a toplevel has been created and any system menus need
3929 * to be created. Only applicable to Windows.
39293930 *
39303931 * Results:
39313932 * None.
40234024 *
40244025 * TkpMenuThreadInit --
40254026 *
4026 * Does platform-specific initialization of thread-specific
4027 * menu state.
4027 * Does platform-specific initialization of thread-specific menu state.
40284028 *
40294029 * Results:
40304030 * None.
40694069 if ((mbRefPtr != NULL) && (mbRefPtr->menuPtr != NULL)) {
40704070 int code;
40714071
4072 Tcl_Preserve((ClientData) currentMenuBarInterp);
4072 Tcl_Preserve(currentMenuBarInterp);
40734073 code = TkPreprocessMenu(mbRefPtr->menuPtr->masterMenuPtr);
40744074 if ((code != TCL_OK) && (code != TCL_CONTINUE)
40754075 && (code != TCL_BREAK)) {
40764076 Tcl_AddErrorInfo(currentMenuBarInterp,
40774077 "\n (menu preprocess)");
4078 Tcl_BackgroundError(currentMenuBarInterp);
4079 }
4080 Tcl_Release((ClientData) currentMenuBarInterp);
4078 Tcl_BackgroundException(currentMenuBarInterp, code);
4079 }
4080 Tcl_Release(currentMenuBarInterp);
40814081 }
40824082 }
40834083 }
40894089 *
40904090 * MenuDefProc --
40914091 *
4092 * This routine is the MDEF handler for Tk. It receives all messages
4093 * for the menu and dispatches them.
4092 * This routine is the MDEF handler for Tk. It receives all messages for
4093 * the menu and dispatches them.
40944094 *
40954095 * Results:
40964096 * None.
40974097 *
40984098 * Side effects:
40994099 * This routine causes menus to be drawn and will certainly allocate
4100 * memory as a result. Also, the menu can scroll up and down, and
4101 * various other interface actions can take place.
4100 * memory as a result. Also, the menu can scroll up and down, and various
4101 * other interface actions can take place.
41024102 *
41034103 *----------------------------------------------------------------------
41044104 */
41074107 MenuDefProc(
41084108 SInt16 message, /* What action are we taking? */
41094109 MenuRef menu, /* The menu we are working with */
4110 Rect *menuRectPtr, /* A pointer to the rect for the
4111 * whole menu. */
4112 Point hitPt, /* Where the mouse was clicked for
4113 * the appropriate messages. */
4114 SInt16 *whichItem) /* Output result. Which item was
4115 * hit by the user? */
4110 Rect *menuRectPtr, /* A pointer to the rect for the whole
4111 * menu. */
4112 Point hitPt, /* Where the mouse was clicked for the
4113 * appropriate messages. */
4114 SInt16 *whichItem) /* Output result. Which item was hit by the
4115 * user? */
41164116 {
41174117 TkMenu *menuPtr;
41184118 Tcl_HashEntry *commandEntryPtr;
41204120
41214121 menuID = GetMenuID(menu);
41224122 commandEntryPtr = Tcl_FindHashEntry(&commandTable, (char*)(intptr_t)menuID);
4123
4124 if (commandEntryPtr) {
4125 menuPtr = (TkMenu *) Tcl_GetHashValue(commandEntryPtr);
4126 } else {
4127 menuPtr = NULL;
4128 }
4123 if (!commandEntryPtr) return;
4124 menuPtr = Tcl_GetHashValue(commandEntryPtr);
41294125
41304126 switch (message) {
4131 case kMenuInitMsg:
4132 *whichItem = noErr;
4133 break;
4134 case kMenuDisposeMsg:
4135 break;
4136 case kMenuHiliteItemMsg:
4137 HandleMenuHiliteMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
4138 break;
4139 case kMenuCalcItemMsg:
4140 HandleMenuCalcItemMsg(menu, menuRectPtr, hitPt, whichItem,
4141 menuPtr);
4142 break;
4143 case kMenuDrawItemsMsg:
4127 case kMenuInitMsg:
4128 *whichItem = noErr;
4129 break;
4130 case kMenuDisposeMsg:
4131 break;
4132 case kMenuHiliteItemMsg:
4133 HandleMenuHiliteMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
4134 break;
4135 case kMenuCalcItemMsg:
4136 HandleMenuCalcItemMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
4137 break;
4138 case kMenuDrawItemsMsg:
41444139 #ifdef TK_MAC_DEBUG_MENUS
4145 TkMacOSXDbgMsg("MDEF: DrawItemsMsg");
4140 TkMacOSXDbgMsg("MDEF: DrawItemsMsg");
41464141 #endif
4147 /*
4148 * We do nothing here, because we don't support the Menu Managers
4149 * dynamic item groups
4150 */
4151 break;
4152 case kMenuThemeSavvyMsg:
4153 *whichItem = kThemeSavvyMenuResponse;
4154 break;
4155 case kMenuSizeMsg:
4142 /*
4143 * We do nothing here, because we don't support the Menu Managers
4144 * dynamic item groups
4145 */
4146
4147 break;
4148 case kMenuThemeSavvyMsg:
4149 *whichItem = kThemeSavvyMenuResponse;
4150 break;
4151 case kMenuSizeMsg:
41564152 #ifdef TK_MAC_DEBUG_MENUS
4157 TkMacOSXDbgMsg("MDEF: SizeMsg %d, %d", hitPt.h, hitPt.v);
4153 TkMacOSXDbgMsg("MDEF: SizeMsg %d, %d", hitPt.h, hitPt.v);
41584154 #endif
4159 SetMenuWidth(menu, hitPt.h < menuPtr->totalWidth ? hitPt.h :
4160 menuPtr->totalWidth);
4161 SetMenuHeight(menu, hitPt.v < menuPtr->totalHeight ? hitPt.v :
4162 menuPtr->totalHeight);
4163 break;
4164 case kMenuDrawMsg:
4165 HandleMenuDrawMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
4166 break;
4167 case kMenuFindItemMsg:
4168 HandleMenuFindItemMsg(menu, menuRectPtr, hitPt, whichItem,
4169 menuPtr);
4170 break;
4171 case kMenuPopUpMsg:
4172 HandleMenuPopUpMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
4173 break;
4155 SetMenuWidth(menu, hitPt.h < menuPtr->totalWidth ? hitPt.h :
4156 menuPtr->totalWidth);
4157 SetMenuHeight(menu, hitPt.v < menuPtr->totalHeight ? hitPt.v :
4158 menuPtr->totalHeight);
4159 break;
4160 case kMenuDrawMsg:
4161 HandleMenuDrawMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
4162 break;
4163 case kMenuFindItemMsg:
4164 HandleMenuFindItemMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
4165 break;
4166 case kMenuPopUpMsg:
4167 HandleMenuPopUpMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
4168 break;
41744169 }
41754170 }
41764171
42014196 OSStatus err;
42024197 Tk_Font tkfont;
42034198 Tk_FontMetrics fontMetrics;
4204 MDEFHiliteItemData *hidPtr = (MDEFHiliteItemData *)whichItem;
4199 MDEFHiliteItemData *hidPtr = (MDEFHiliteItemData *) whichItem;
42054200 int oldItem = hidPtr->previousItem - 1;
42064201 int newItem = hidPtr->newItem - 1;
42074202 MenuTrackingData mtd, *mtdPtr = &mtd;
42594254 TkMenuEntry *mePtr;
42604255 int i;
42614256 Rect menuClipRect, bounds;
4262 MDEFDrawData *ddPtr = (MDEFDrawData*)whichItem;
4257 MDEFDrawData *ddPtr = (MDEFDrawData *) whichItem;
42634258 MenuTrackingData *mtdPtr = &(ddPtr->trackingData);
4264 TkWindow *winPtr = (TkWindow*)menuPtr->tkwin;
4259 TkWindow *winPtr = (TkWindow *) menuPtr->tkwin;
42654260
42664261 GetPort(&macMDEFDrawable.grafPtr);
42674262 GetPortBounds(macMDEFDrawable.grafPtr, &bounds);
43414336 }
43424337
43434338 /*
4344 * Now, actually draw the menu. Don't draw entries that
4345 * are higher than the top arrow, and don't draw entries
4346 * that are lower than the bottom.
4339 * Now, actually draw the menu. Don't draw entries that are higher than
4340 * the top arrow, and don't draw entries that are lower than the bottom.
43474341 */
43484342
43494343 for (i = 0; i < menuPtr->numEntries; i++) {
43644358 *
43654359 * HandleMenuFindItemMsg --
43664360 *
4367 * Handles the MenuDefProc's FindItems message. We have to
4368 * respond by filling in the itemSelected, itemUnderMouse and
4369 * itemRect fields. This is also the time to scroll the menu if
4370 * it is too long to fit on the screen.
4371 *
4372 * Results:
4373 * The Menu system is informed of the selected item & the item
4374 * under the mouse.
4361 * Handles the MenuDefProc's FindItems message. We have to respond by
4362 * filling in the itemSelected, itemUnderMouse and itemRect fields. This
4363 * is also the time to scroll the menu if it is too long to fit on the
4364 * screen.
4365 *
4366 * Results:
4367 * The Menu system is informed of the selected item & the item under the
4368 * mouse.
43754369 *
43764370 * Side effects:
43774371 * The menu might get scrolled.
43784372 *
43794373 *----------------------------------------------------------------------
43804374 */
4375
43814376 void
43824377 HandleMenuFindItemMsg(
43834378 MenuRef menu,
44014396
44024397 #ifdef TK_MAC_DEBUG_MENUS
44034398 static Point lastHitPt = {0, 0};
4399
44044400 if (hitPt.h != lastHitPt.h || hitPt.v != lastHitPt.v) {
44054401 lastHitPt = hitPt;
44064402 TkMacOSXDbgMsg("MDEF: FindItemMsg: %d, %d", hitPt.h, hitPt.v);
44494445 }
44504446 if (scrollDirection == DONT_SCROLL) {
44514447 /*
4452 * Find out which item was hit. If it is the same as the old item,
4453 * we don't need to do anything.
4448 * Find out which item was hit. If it is the same as the old item, we
4449 * don't need to do anything.
44544450 */
44554451
44564452 if (PtInRect(hitPt, menuRectPtr)) {
45984594 *
45994595 * HandleMenuPopUpMsg --
46004596 *
4601 * Handles the MenuDefProc's PopUp message. The menu is
4602 * posted with the selected item at the point given in hitPt.
4597 * Handles the MenuDefProc's PopUp message. The menu is posted with the
4598 * selected item at the point given in hitPt.
46034599 *
46044600 * Results:
46054601 * A menu is posted.
46094605 *
46104606 *----------------------------------------------------------------------
46114607 */
4608
46124609 void
46134610 HandleMenuPopUpMsg(
46144611 MenuRef menu,
46334630 GetQDGlobalsScreenBits(&screenBits);
46344631
46354632 /*
4636 * Note that for some oddball reason, h and v are reversed in the
4637 * point given to us by the MDEF.
4633 * Note that for some oddball reason, h and v are reversed in the point
4634 * given to us by the MDEF.
46384635 */
46394636
46404637 oldItem = *whichItem;
46904687 *
46914688 * HandleMenuCalcItemMsg --
46924689 *
4693 * Handles the MenuDefProc's CalcItem message. It is supposed
4694 * to calculate the Rect of the menu entry in whichItem in the
4695 * menu, and put that in menuRectPtr. I assume this works, but I
4696 * have never seen the MenuManager send this message.
4697 *
4698 * Results:
4699 * The Menu Manager is informed of the bounding rect of a
4700 * menu rect.
4690 * Handles the MenuDefProc's CalcItem message. It is supposed to
4691 * calculate the Rect of the menu entry in whichItem in the menu, and put
4692 * that in menuRectPtr. I assume this works, but I have never seen the
4693 * MenuManager send this message.
4694 *
4695 * Results:
4696 * The Menu Manager is informed of the bounding rect of a menu rect.
47014697 *
47024698 * Side effects:
47034699 * None.
47424738 #endif
47434739 }
47444740 #endif /* USE_TK_MDEF */
4741
4742 /*
4743 * Local Variables:
4744 * fill-column: 78
4745 * c-basic-offset: 4
4746 * End:
4747 */
1010 * See the file "license.terms" for information on usage and redistribution
1111 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.18 2007/12/13 15:27:10 dgp Exp $
13 * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.20 2008/12/07 16:36:26 das Exp $
1414 */
1515
1616 #include "tkMacOSXPrivate.h"
442442 */
443443
444444 void
445 TkpComputeMenuButtonGeometry(mbPtr)
446 register TkMenuButton *mbPtr; /* Widget record for menu button. */
447 {
448 int width, height, mm, pixels;
445 TkpComputeMenuButtonGeometry(
446 register TkMenuButton *mbPtr) /* Widget record for menu button. */
447 {
448 int width, height;
449449 int hasImageOrBitmap = 0;
450450
451451 mbPtr->inset = mbPtr->highlightWidth + mbPtr->borderWidth;
489489 width += TK_POPUP_OFFSET;
490490 }
491491 if (mbPtr->indicatorOn) {
492 mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin));
493 pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin));
494492 mbPtr->indicatorHeight = kTriangleHeight;
495493 mbPtr->indicatorWidth = kTriangleWidth + kTriangleMargin;
496494 width += mbPtr->indicatorWidth;
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.22 2008/10/05 18:22:21 dkf Exp $
13 * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.24 2008/12/09 21:22:56 dgp Exp $
1414 */
1515
1616 #include "tkMacOSXPrivate.h"
101101 Window window;
102102 TkDisplay *dispPtr;
103103 Tcl_CmdInfo dummy;
104 int code;
104105
105106 if (theItem == 0) {
106107 TkMacOSXClearMenubarActive();
115116 Tcl_GetCommandInfo(gInterp, "tkAboutDialog", &dummy) == 0) {
116117 TkAboutDlg();
117118 } else {
118 if (Tcl_EvalEx(gInterp, "tkAboutDialog", -1,
119 TCL_EVAL_GLOBAL) != TCL_OK) {
120 Tcl_BackgroundError(gInterp);
119 code = Tcl_EvalEx(gInterp, "tkAboutDialog", -1,
120 TCL_EVAL_GLOBAL);
121 if (code != TCL_OK) {
122 Tcl_BackgroundException(gInterp, code);
121123 }
122124 Tcl_ResetResult(gInterp);
123125 }
137139 Tcl_GetStringFromObj(path, &len);
138140 if (len) {
139141 Tcl_IncrRefCount(path);
140 if (Tcl_FSEvalFile(gInterp, path) == TCL_ERROR) {
141 Tcl_BackgroundError(gInterp);
142 code = Tcl_FSEvalFile(gInterp, path);
143 if (code != TCL_OK) {
144 Tcl_BackgroundException(gInterp, code);
142145 }
143146 Tcl_DecrRefCount(path);
144147 }
152155
153156 if (path) {
154157 Tcl_IncrRefCount(path);
155 if (Tcl_FSEvalFile(gInterp, path) == TCL_ERROR) {
156 Tcl_BackgroundError(gInterp);
158 code = Tcl_FSEvalFile(gInterp, path);
159 if (code != TCL_OK) {
160 Tcl_BackgroundException(gInterp, code);
157161 }
158162 Tcl_DecrRefCount(path);
159163 Tcl_ResetResult(gInterp);
375379
376380 XQueryPointer(NULL, None, NULL, NULL,
377381 &event.x_root, &event.y_root, &x, &y, &event.state);
378 tkwin = Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y);
382 Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y);
379383 event.same_screen = true;
380384
381385 switch (flag) {
00 /*
11 * tkMacOSXMouseEvent.c --
22 *
3 * This file implements functions that decode & handle mouse events
4 * on MacOS X.
3 * This file implements functions that decode & handle mouse events on
4 * MacOS X.
55 *
66 * Copyright 2001, Apple Computer, Inc.
77 * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
1212 * The following terms apply to all files originating from Apple
13 * Computer, Inc. ("Apple") and associated with the software
14 * unless explicitly disclaimed in individual files.
15 *
16 *
17 * Apple hereby grants permission to use, copy, modify,
18 * distribute, and license this software and its documentation
19 * for any purpose, provided that existing copyright notices are
20 * retained in all copies and that this notice is included
21 * verbatim in any distributions. No written agreement, license,
22 * or royalty fee is required for any of the authorized
23 * uses. Modifications to this software may be copyrighted by
24 * their authors and need not follow the licensing terms
25 * described here, provided that the new terms are clearly
26 * indicated on the first page of each file where they apply.
27 *
28 *
29 * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE
30 * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
31 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
32 * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
33 * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND
35 * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
36 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
37 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS
38 * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE
39 * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
13 * Computer, Inc. ("Apple") and associated with the software unless
14 * explicitly disclaimed in individual files.
15 *
16 * Apple hereby grants permission to use, copy, modify, distribute, and
17 * license this software and its documentation for any purpose, provided
18 * that existing copyright notices are retained in all copies and that
19 * this notice is included verbatim in any distributions. No written
20 * agreement, license, or royalty fee is required for any of the
21 * authorized uses. Modifications to this software may be copyrighted by
22 * their authors and need not follow the licensing terms described here,
23 * provided that the new terms are clearly indicated on the first page of
24 * each file where they apply.
25 *
26 * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE SOFTWARE
27 * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
28 * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS
29 * DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF APPLE OR THE
30 * AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APPLE,
31 * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
32 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
34 * NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND
35 * APPLE,THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
4036 * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
4137 *
42 * GOVERNMENT USE: If you are acquiring this software on behalf
43 * of the U.S. government, the Government shall have only
44 * "Restricted Rights" in the software and related documentation
45 * as defined in the Federal Acquisition Regulations (FARs) in
46 * Clause 52.227.19 (c) (2). If you are acquiring the software
47 * on behalf of the Department of Defense, the software shall be
48 * classified as "Commercial Computer Software" and the
49 * Government shall have only "Restricted Rights" as defined in
50 * Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the
51 * foregoing, the authors grant the U.S. Government and others
52 * acting in its behalf permission to use and distribute the
53 * software in accordance with the terms specified in this
54 * license.
55 *
56 * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.34 2007/12/13 15:27:10 dgp Exp $
38 * GOVERNMENT USE: If you are acquiring this software on behalf of the
39 * U.S. government, the Government shall have only "Restricted Rights" in
40 * the software and related documentation as defined in the Federal
41 * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are
42 * acquiring the software on behalf of the Department of Defense, the
43 * software shall be classified as "Commercial Computer Software" and the
44 * Government shall have only "Restricted Rights" as defined in Clause
45 * 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
46 * authors grant the U.S. Government and others acting in its behalf
47 * permission to use and distribute the software in accordance with the
48 * terms specified in this license.
49 *
50 * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.35 2008/10/27 11:55:45 dkf Exp $
5751 */
5852
5953 #include "tkMacOSXPrivate.h"
6256 #include "tkMacOSXDebug.h"
6357
6458 typedef struct {
65 WindowRef whichWin;
66 WindowRef activeNonFloating;
59 WindowRef whichWin;
60 WindowRef activeNonFloating;
6761 WindowPartCode windowPart;
68 unsigned int state;
69 long delta;
70 Window window;
71 Point global;
72 Point local;
62 unsigned int state;
63 long delta;
64 Window window;
65 Point global;
66 Point local;
7367 } MouseEventData;
7468
7569 /*
7670 * Declarations of static variables used in this file.
7771 */
7872
79 static int gEatButtonUp = 0; /* 1 if we need to eat the next up event */
73 static int gEatButtonUp = 0; /* 1 if we need to eat the next up event. */
8074
8175 /*
8276 * Declarations of functions used only in this file.
8377 */
8478
85 static void BringWindowForward(WindowRef wRef, int isFrontProcess,
86 int frontWindowOnly);
87 static int GeneratePollingEvents(MouseEventData * medPtr);
88 static int GenerateMouseWheelEvent(MouseEventData * medPtr);
89 static int GenerateButtonEvent(MouseEventData * medPtr);
90 static int GenerateToolbarButtonEvent(MouseEventData * medPtr);
91 static int HandleWindowTitlebarMouseDown(MouseEventData * medPtr, Tk_Window tkwin);
92 static unsigned int ButtonModifiers2State(UInt32 buttonState, UInt32 keyModifiers);
93 static Tk_Window GetGrabWindowForWindow(Tk_Window tkwin);
94
95 static int TkMacOSXGetEatButtonUp(void);
96 static void TkMacOSXSetEatButtonUp(int f);
97
79 static void BringWindowForward(WindowRef wRef, int isFrontProcess,
80 int frontWindowOnly);
81 static int GeneratePollingEvents(MouseEventData *medPtr);
82 static int GenerateMouseWheelEvent(MouseEventData *medPtr);
83 static int GenerateButtonEvent(MouseEventData *medPtr);
84 static int GenerateToolbarButtonEvent(MouseEventData *medPtr);
85 static int HandleWindowTitlebarMouseDown(MouseEventData *medPtr,
86 Tk_Window tkwin);
87 static unsigned int ButtonModifiers2State(UInt32 buttonState,
88 UInt32 keyModifiers);
89 static Tk_Window GetGrabWindowForWindow(Tk_Window tkwin);
90 static int TkMacOSXGetEatButtonUp(void);
91 static void TkMacOSXSetEatButtonUp(int f);
9892
9993 /*
10094 *----------------------------------------------------------------------
10195 *
10296 * TkMacOSXProcessMouseEvent --
10397 *
104 * This routine processes the event in eventPtr, and
105 * generates the appropriate Tk events from it.
98 * This routine processes the event in eventPtr, and generates the
99 * appropriate Tk events from it.
106100 *
107101 * Results:
108102 * True if event(s) are generated - false otherwise.
114108 */
115109
116110 MODULE_SCOPE int
117 TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
111 TkMacOSXProcessMouseEvent(
112 TkMacOSXEvent *eventPtr,
113 MacEventStatus *statusPtr)
118114 {
119115 Tk_Window tkwin;
120116 Point where, where2;
121117 int result;
122 TkDisplay * dispPtr;
118 TkDisplay *dispPtr;
123119 OSStatus err;
124 MouseEventData mouseEventData, * medPtr = &mouseEventData;
120 MouseEventData mouseEventData, *medPtr = &mouseEventData;
125121 int isFrontProcess;
126122
127123 switch (eventPtr->eKind) {
128 case kEventMouseDown:
129 case kEventMouseUp:
130 case kEventMouseMoved:
131 case kEventMouseDragged:
132 case kEventMouseWheelMoved:
133 break;
134 default:
135 return false;
136 break;
137 }
124 case kEventMouseDown:
125 case kEventMouseUp:
126 case kEventMouseMoved:
127 case kEventMouseDragged:
128 case kEventMouseWheelMoved:
129 break;
130 default:
131 return false;
132 }
133
138134 err = ChkErr(GetEventParameter, eventPtr->eventRef,
139 kEventParamMouseLocation,
140 typeQDPoint, NULL,
141 sizeof(where), NULL,
135 kEventParamMouseLocation, typeQDPoint, NULL, sizeof(where), NULL,
142136 &where);
143137 if (err != noErr) {
144138 GetGlobalMouse(&where);
145139 }
146 err = ChkErr(GetEventParameter, eventPtr->eventRef,
147 kEventParamWindowRef,
148 typeWindowRef, NULL,
149 sizeof(WindowRef), NULL,
150 &medPtr->whichWin);
140
141 err = ChkErr(GetEventParameter, eventPtr->eventRef, kEventParamWindowRef,
142 typeWindowRef, NULL, sizeof(WindowRef), NULL, &medPtr->whichWin);
151143 if (err == noErr) {
152144 err = ChkErr(GetEventParameter, eventPtr->eventRef,
153 kEventParamWindowPartCode,
154 typeWindowPartCode, NULL,
155 sizeof(WindowPartCode), NULL,
156 &medPtr->windowPart);
145 kEventParamWindowPartCode, typeWindowPartCode, NULL,
146 sizeof(WindowPartCode), NULL, &medPtr->windowPart);
157147 }
158148 if (err != noErr) {
159149 medPtr->windowPart = FindWindow(where, &medPtr->whichWin);
189179 }
190180 medPtr->global = where;
191181 err = ChkErr(GetEventParameter, eventPtr->eventRef,
192 kEventParamWindowMouseLocation,
193 typeQDPoint, NULL,
194 sizeof(Point), NULL,
195 &medPtr->local);
182 kEventParamWindowMouseLocation, typeQDPoint, NULL,
183 sizeof(Point), NULL, &medPtr->local);
196184 if (err == noErr) {
197185 if (medPtr->whichWin) {
198186 Rect widths;
187
199188 GetWindowStructureWidths(medPtr->whichWin, &widths);
200189 medPtr->local.h -= widths.left;
201190 medPtr->local.v -= widths.top;
215204 int res = false;
216205
217206 switch (eventPtr->eKind) {
218 case kEventMouseUp:
219 /*
220 * The window manager only needs to know about mouse down
221 * events and sometimes we need to "eat" the mouse up.
222 * Otherwise, we just pass the event to Tk.
223 */
224 if (TkMacOSXGetEatButtonUp()) {
225 TkMacOSXSetEatButtonUp(false);
226 } else {
227 res = GenerateButtonEvent(medPtr);
207 case kEventMouseUp:
208 /*
209 * The window manager only needs to know about mouse down events
210 * and sometimes we need to "eat" the mouse up. Otherwise, we just
211 * pass the event to Tk.
212 */
213
214 if (TkMacOSXGetEatButtonUp()) {
215 TkMacOSXSetEatButtonUp(false);
216 } else {
217 res = GenerateButtonEvent(medPtr);
218 }
219 break;
220 case kEventMouseWheelMoved:
221 err = ChkErr(GetEventParameter, eventPtr->eventRef,
222 kEventParamMouseWheelDelta, typeLongInteger, NULL,
223 sizeof(long), NULL, &medPtr->delta);
224 if (err != noErr ) {
225 statusPtr->err = 1;
226 } else {
227 EventMouseWheelAxis axis;
228
229 err = ChkErr(GetEventParameter, eventPtr->eventRef,
230 kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL,
231 sizeof(EventMouseWheelAxis), NULL, &axis);
232 if (err == noErr && axis == kEventMouseWheelAxisX) {
233 medPtr->state |= ShiftMask;
228234 }
229 break;
230 case kEventMouseWheelMoved:
231 err = ChkErr(GetEventParameter, eventPtr->eventRef,
232 kEventParamMouseWheelDelta, typeLongInteger, NULL,
233 sizeof(long), NULL, &medPtr->delta);
234 if (err != noErr ) {
235 statusPtr->err = 1;
236 } else {
237 EventMouseWheelAxis axis;
238 err = ChkErr(GetEventParameter, eventPtr->eventRef,
239 kEventParamMouseWheelAxis, typeMouseWheelAxis,
240 NULL, sizeof(EventMouseWheelAxis), NULL, &axis);
241 if (err == noErr && axis == kEventMouseWheelAxisX) {
242 medPtr->state |= ShiftMask;
243 }
244 res = GenerateMouseWheelEvent(medPtr);
245 }
246 break;
247 case kEventMouseMoved:
248 case kEventMouseDragged:
249 res = GeneratePollingEvents(medPtr);
250 break;
251 default:
252 Tcl_Panic("Unknown mouse event !");
253 }
254 if (res) {
255 statusPtr->stopProcessing = 1;
256 }
257 return res;
258 }
259 TkMacOSXSetEatButtonUp(false);
260 if (medPtr->whichWin) {
261 /*
262 * We got a mouse down in a window
263 * See if this is the activate click
264 * This click moves the window forward. We don't want
265 * the corresponding mouse-up to be reported to the application
266 * or else it will mess up some Tk scripts.
267 */
268
269 if (!(TkpIsWindowFloating(medPtr->whichWin))
270 && (medPtr->whichWin != medPtr->activeNonFloating
271 || !isFrontProcess)) {
272 int frontWindowOnly = 1;
273 int cmdDragGrow = ((medPtr->windowPart == inDrag ||
274 medPtr->windowPart == inGrow) && medPtr->state & Mod1Mask);
275
276 if (!cmdDragGrow) {
277 Tk_Window grabWin = GetGrabWindowForWindow(tkwin);
278
279 frontWindowOnly = !grabWin;
280 if (grabWin && grabWin != tkwin) {
281 TkMacOSXSetEatButtonUp(true);
282 BringWindowForward(TkMacOSXDrawableWindow(
283 ((TkWindow*)grabWin)->window), isFrontProcess,
284 frontWindowOnly);
285 return false;
286 }
287 }
288
289 /*
290 * Clicks in the titlebar widgets are handled without bringing the
291 * window forward.
292 */
293 if ((result = HandleWindowTitlebarMouseDown(medPtr, tkwin)) != -1) {
294 statusPtr->stopProcessing = 1;
295 return result;
296 } else {
297 /*
298 * Only windows with the kWindowNoActivatesAttribute can
299 * receive mouse events in the background.
300 */
301 if (!(((TkWindow *)tkwin)->wmInfoPtr->attributes &
302 kWindowNoActivatesAttribute)) {
303 /*
304 * Allow background window dragging & growing with Command
305 * down.
306 */
307 if (!cmdDragGrow) {
308 TkMacOSXSetEatButtonUp(true);
309 BringWindowForward(medPtr->whichWin, isFrontProcess,
310 frontWindowOnly);
311 }
312 /*
313 * Allow dragging & growing of windows that were/are in the
314 * background.
315 */
316 if (!(medPtr->windowPart == inDrag ||
317 medPtr->windowPart == inGrow)) {
318 return false;
319 }
320 }
321 }
322 } else {
323 if ((result = HandleWindowTitlebarMouseDown(medPtr, tkwin)) != -1) {
324 statusPtr->stopProcessing = 1;
325 return result;
326 }
327 }
328 switch (medPtr->windowPart) {
329 case inDrag: {
330 WindowAttributes attributes;
331
332 GetWindowAttributes(medPtr->whichWin, &attributes);
333 if (!(attributes & kWindowAsyncDragAttribute)) {
334 TkMacOSXTrackingLoop(1);
335 DragWindow(medPtr->whichWin, where, NULL);
336 TkMacOSXTrackingLoop(0);
337 where2.h = where2.v = 0;
338 QDLocalToGlobalPoint(GetWindowPort(medPtr->whichWin),
339 &where2);
340 if (EqualPt(where, where2)) {
341 return false;
342 }
343 return true;
344 }
345 break;
346 }
347 case inGrow:
348 /*
349 * Generally the content region is the domain of Tk
350 * sub-windows. However, one exception is the grow
351 * region. A button down in this area will be handled
352 * by the window manager. Note: this means that Tk
353 * may not get button down events in this area!
354 */
355 if (TkMacOSXGrowToplevel(medPtr->whichWin, where) == true) {
356 statusPtr->stopProcessing = 1;
357 return true;
358 } else {
359 return GenerateButtonEvent(medPtr);
360 }
361 break;
362 case inContent:
363 return GenerateButtonEvent(medPtr);
364 break;
365 default:
366 return false;
367 break;
368 }
369 }
370 return false;
371 }
372
373 /*
374 *----------------------------------------------------------------------
375 *
376 * HandleWindowTitlebarMouseDown --
377 *
378 * Handle clicks in window titlebar.
379 *
380 * Results:
381 * 1 if event was handled, 0 if event was not handled,
382 * -1 if MouseDown was not in window titlebar.
383 *
384 * Side effects:
385 * Additional events may be place on the Tk event queue.
386 *
387 *----------------------------------------------------------------------
388 */
389
390 int
391 HandleWindowTitlebarMouseDown(MouseEventData * medPtr, Tk_Window tkwin)
392 {
393 int result = INT_MAX;
394
395 switch (medPtr->windowPart) {
396 case inGoAway:
397 case inCollapseBox:
398 case inZoomIn:
399 case inZoomOut:
400 case inToolbarButton:
401 if (!IsWindowActive(medPtr->whichWin)) {
402 WindowRef frontWindow = FrontNonFloatingWindow();
403 WindowModality frontWindowModality = kWindowModalityNone;
404
405 if (frontWindow && frontWindow != medPtr->whichWin) {
406 ChkErr(GetWindowModality, frontWindow,
407 &frontWindowModality, NULL);
408 }
409 if (frontWindowModality == kWindowModalityAppModal) {
410 result = 0;
411 }
412 }
235 res = GenerateMouseWheelEvent(medPtr);
236 }
237 break;
238 case kEventMouseMoved:
239 case kEventMouseDragged:
240 res = GeneratePollingEvents(medPtr);
413241 break;
414242 default:
415 result = -1;
416 break;
243 Tcl_Panic("Unknown mouse event !");
244 }
245 if (res) {
246 statusPtr->stopProcessing = 1;
247 }
248 return res;
249 }
250
251 TkMacOSXSetEatButtonUp(false);
252 if (!medPtr->whichWin) {
253 return false;
254 }
255
256 /*
257 * We got a mouse down in a window, so see if this is the activate click.
258 * This click moves the window forward. We don't want the corresponding
259 * mouse-up to be reported to the application or else it will mess up some
260 * Tk scripts.
261 */
262
263 if (!(TkpIsWindowFloating(medPtr->whichWin))
264 && (medPtr->whichWin != medPtr->activeNonFloating
265 || !isFrontProcess)) {
266 int frontWindowOnly = 1;
267 int cmdDragGrow = ((medPtr->windowPart == inDrag ||
268 medPtr->windowPart == inGrow) && medPtr->state & Mod1Mask);
269
270 if (!cmdDragGrow) {
271 Tk_Window grabWin = GetGrabWindowForWindow(tkwin);
272
273 frontWindowOnly = !grabWin;
274 if (grabWin && grabWin != tkwin) {
275 TkMacOSXSetEatButtonUp(true);
276 BringWindowForward(TkMacOSXDrawableWindow(
277 ((TkWindow *) grabWin)->window), isFrontProcess,
278 frontWindowOnly);
279 return false;
280 }
281 }
282
283 /*
284 * Clicks in the titlebar widgets are handled without bringing the
285 * window forward.
286 */
287
288 result = HandleWindowTitlebarMouseDown(medPtr, tkwin);
289 if (result != -1) {
290 statusPtr->stopProcessing = 1;
291 return result;
292 }
293
294 /*
295 * Only windows with the kWindowNoActivatesAttribute can receive mouse
296 * events in the background.
297 */
298
299 if (!(((TkWindow *)tkwin)->wmInfoPtr->attributes &
300 kWindowNoActivatesAttribute)) {
301 /*
302 * Allow background window dragging & growing with Command down.
303 */
304
305 if (!cmdDragGrow) {
306 TkMacOSXSetEatButtonUp(true);
307 BringWindowForward(medPtr->whichWin, isFrontProcess,
308 frontWindowOnly);
309 }
310
311 /*
312 * Allow dragging & growing of windows that were/are in the
313 * background.
314 */
315
316 if (!(medPtr->windowPart == inDrag ||
317 medPtr->windowPart == inGrow)) {
318 return false;
319 }
320 }
321 } else {
322 result = HandleWindowTitlebarMouseDown(medPtr, tkwin);
323 if (result != -1) {
324 statusPtr->stopProcessing = 1;
325 return result;
326 }
327 }
328
329 switch (medPtr->windowPart) {
330 case inDrag: {
331 WindowAttributes attributes;
332
333 GetWindowAttributes(medPtr->whichWin, &attributes);
334 if (!(attributes & kWindowAsyncDragAttribute)) {
335 TkMacOSXTrackingLoop(1);
336 DragWindow(medPtr->whichWin, where, NULL);
337 TkMacOSXTrackingLoop(0);
338 where2.h = where2.v = 0;
339 QDLocalToGlobalPoint(GetWindowPort(medPtr->whichWin), &where2);
340 return (EqualPt(where, where2)) ? false : true;
341 }
342 break;
343 }
344 case inGrow:
345 /*
346 * Generally the content region is the domain of Tk sub-windows.
347 * However, one exception is the grow region. A button down in this
348 * area will be handled by the window manager. Note: this means that
349 * Tk may not get button down events in this area!
350 */
351
352 if (TkMacOSXGrowToplevel(medPtr->whichWin, where) == true) {
353 statusPtr->stopProcessing = 1;
354 return true;
355 }
356 case inContent:
357 return GenerateButtonEvent(medPtr);
358 }
359 return false;
360 }
361
362 /*
363 *----------------------------------------------------------------------
364 *
365 * HandleWindowTitlebarMouseDown --
366 *
367 * Handle clicks in window titlebar.
368 *
369 * Results:
370 * 1 if event was handled, 0 if event was not handled, -1 if MouseDown
371 * was not in window titlebar.
372 *
373 * Side effects:
374 * Additional events may be place on the Tk event queue.
375 *
376 *----------------------------------------------------------------------
377 */
378
379 int
380 HandleWindowTitlebarMouseDown(
381 MouseEventData *medPtr,
382 Tk_Window tkwin)
383 {
384 int result = INT_MAX;
385
386 switch (medPtr->windowPart) {
387 case inGoAway:
388 case inCollapseBox:
389 case inZoomIn:
390 case inZoomOut:
391 case inToolbarButton:
392 if (!IsWindowActive(medPtr->whichWin)) {
393 WindowRef frontWindow = FrontNonFloatingWindow();
394 WindowModality frontWindowModality = kWindowModalityNone;
395
396 if (frontWindow && frontWindow != medPtr->whichWin) {
397 ChkErr(GetWindowModality, frontWindow,
398 &frontWindowModality, NULL);
399 }
400 if (frontWindowModality == kWindowModalityAppModal) {
401 result = 0;
402 }
403 }
404 break;
405 default:
406 result = -1;
407 break;
417408 }
418409
419410 if (result == INT_MAX) {
420411 result = 0;
421412 TkMacOSXTrackingLoop(1);
422413 switch (medPtr->windowPart) {
423 case inGoAway:
424 if (TrackGoAway(medPtr->whichWin, medPtr->global) && tkwin) {
425 TkGenWMDestroyEvent(tkwin);
426 result = 1;
427 }
428 break;
429 case inCollapseBox:
430 if (TrackBox(medPtr->whichWin, medPtr->global,
431 medPtr->windowPart) && tkwin) {
432 TkpWmSetState((TkWindow *)tkwin, IconicState);
433 result = 1;
434 }
435 break;
436 case inZoomIn:
437 case inZoomOut:
438 if (TrackBox(medPtr->whichWin, medPtr->global,
439 medPtr->windowPart)) {
440 result = TkMacOSXZoomToplevel(medPtr->whichWin,
441 medPtr->windowPart);
442 }
443 break;
444 case inToolbarButton:
445 if (TrackBox(medPtr->whichWin, medPtr->global,
446 medPtr->windowPart)) {
447 result = GenerateToolbarButtonEvent(medPtr);
448 }
449 break;
414 case inGoAway:
415 if (TrackGoAway(medPtr->whichWin, medPtr->global) && tkwin) {
416 TkGenWMDestroyEvent(tkwin);
417 result = 1;
418 }
419 break;
420 case inCollapseBox:
421 if (TrackBox(medPtr->whichWin, medPtr->global,
422 medPtr->windowPart) && tkwin) {
423 TkpWmSetState((TkWindow *) tkwin, IconicState);
424 result = 1;
425 }
426 break;
427 case inZoomIn:
428 case inZoomOut:
429 if (TrackBox(medPtr->whichWin, medPtr->global,
430 medPtr->windowPart)) {
431 result = TkMacOSXZoomToplevel(medPtr->whichWin,
432 medPtr->windowPart);
433 }
434 break;
435 case inToolbarButton:
436 if (TrackBox(medPtr->whichWin, medPtr->global,
437 medPtr->windowPart)) {
438 result = GenerateToolbarButtonEvent(medPtr);
439 }
440 break;
450441 }
451442 TkMacOSXTrackingLoop(0);
452443 }
459450 *
460451 * GeneratePollingEvents --
461452 *
462 * This function polls the mouse position and generates X Motion,
463 * Enter & Leave events. The cursor is also updated at this
464 * time.
453 * This function polls the mouse position and generates X Motion, Enter &
454 * Leave events. The cursor is also updated at this time.
465455 *
466456 * Results:
467457 * True if event(s) are generated - false otherwise.
468458 *
469459 * Side effects:
470 * Additional events may be place on the Tk event queue.
471 * The cursor may be changed.
460 * Additional events may be place on the Tk event queue. The cursor may
461 * be changed.
472462 *
473463 *----------------------------------------------------------------------
474464 */
475465
476466 static int
477 GeneratePollingEvents(MouseEventData * medPtr)
467 GeneratePollingEvents(
468 MouseEventData *medPtr)
478469 {
479470 Tk_Window tkwin, rootwin, grabWin;
480471 int local_x, local_y;
481472 TkDisplay *dispPtr;
482473
483
484474 grabWin = TkMacOSXGetCapture();
485475
486476 if ((!TkpIsWindowFloating(medPtr->whichWin)
487477 && (medPtr->activeNonFloating != medPtr->whichWin))) {
488478 /*
489 * If the window for this event is not floating, and is not the
490 * active non-floating window, don't generate polling events.
491 * We don't send events to backgrounded windows. So either send
492 * it to the grabWin, or NULL if there is no grabWin.
479 * If the window for this event is not floating, and is not the active
480 * non-floating window, don't generate polling events. We don't send
481 * events to backgrounded windows. So either send it to the grabWin,
482 * or NULL if there is no grabWin.
493483 */
494484
495485 tkwin = grabWin;
496486 } else {
497487 /*
498 * First check whether the toplevel containing this mouse
499 * event is the grab window. If not, then send the event
500 * to the grab window. Otherwise, set tkWin to the subwindow
501 * which most closely contains the mouse event.
488 * First check whether the toplevel containing this mouse event is the
489 * grab window. If not, then send the event to the grab window.
490 * Otherwise, set tkWin to the subwindow which most closely contains
491 * the mouse event.
502492 */
503493
504494 dispPtr = TkGetDisplayList();
507497 || ((grabWin != NULL) && (rootwin != grabWin))) {
508498 tkwin = grabWin;
509499 } else {
510 tkwin = Tk_TopCoordsToWindow(rootwin,
511 medPtr->local.h, medPtr->local.v,
512 &local_x, &local_y);
500 tkwin = Tk_TopCoordsToWindow(rootwin, medPtr->local.h,
501 medPtr->local.v, &local_x, &local_y);
513502 }
514503 }
515504
516505 /*
517 * The following call will generate the appropiate X events and
518 * adjust any state that Tk must remember.
506 * The following call will generate the appropiate X events and adjust any
507 * state that Tk must remember.
519508 */
520509
521510 Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v,
522511 medPtr->state);
523
524512 return true;
525513 }
526514
558546
559547 if (window != None) {
560548 TkDisplay *dispPtr = TkGetDisplayList();
561 TkWindow * winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display,
562 window);
549 TkWindow *winPtr = (TkWindow *)
550 Tk_IdToWindow(dispPtr->display, window);
563551
564552 if (winPtr && winPtr->wmInfoPtr &&
565553 winPtr->wmInfoPtr->master != None) {
585573 if (!isFrontProcess) {
586574 ProcessSerialNumber ourPsn = {0, kCurrentProcess};
587575
588 ChkErr(SetFrontProcessWithOptions, &ourPsn, frontWindowOnly ?
589 kSetFrontProcessFrontWindowOnly : 0);
576 ChkErr(SetFrontProcessWithOptions, &ourPsn,
577 frontWindowOnly ? kSetFrontProcessFrontWindowOnly : 0);
590578 }
591579 }
592580
595583 *
596584 * TkMacOSXBringWindowForward --
597585 *
598 * Bring this window to the front in response to a mouse click. If
599 * a grab is in effect, bring the grab window to the front instead.
586 * Bring this window to the front in response to a mouse click. If a grab
587 * is in effect, bring the grab window to the front instead.
600588 *
601589 * Results:
602590 * None.
612600 WindowRef wRef)
613601 {
614602 TkDisplay *dispPtr = TkGetDisplayList();
615 Tk_Window tkwin = Tk_IdToWindow(dispPtr->display,TkMacOSXGetXWindow(wRef));
603 Tk_Window tkwin =
604 Tk_IdToWindow(dispPtr->display, TkMacOSXGetXWindow(wRef));
616605 Tk_Window grabWin = GetGrabWindowForWindow(tkwin);
617606
618607 if (grabWin && grabWin != tkwin) {
619 wRef = TkMacOSXDrawableWindow(((TkWindow*)grabWin)->window);
608 wRef = TkMacOSXDrawableWindow(((TkWindow *) grabWin)->window);
620609 }
621610 TkMacOSXSetEatButtonUp(true);
622611 BringWindowForward(wRef, Tk_MacOSXIsAppInFront(), !grabWin);
645634 Tk_Window grabWin = TkMacOSXGetCapture();
646635
647636 if (!grabWin) {
648 int grabState = TkGrabState((TkWindow*)tkwin);
637 int grabState = TkGrabState((TkWindow *) tkwin);
649638
650639 if (grabState != TK_GRAB_NONE && grabState != TK_GRAB_IN_TREE) {
651 grabWin = (Tk_Window) (((TkWindow*)tkwin)->dispPtr->grabWinPtr);
640 grabWin = (Tk_Window) (((TkWindow *) tkwin)->dispPtr->grabWinPtr);
652641 }
653642 }
654643
672661 */
673662
674663 static int
675 GenerateMouseWheelEvent(MouseEventData * medPtr)
664 GenerateMouseWheelEvent(
665 MouseEventData *medPtr)
676666 {
677667 Tk_Window tkwin, rootwin;
678668 TkDisplay *dispPtr;
679 TkWindow *winPtr;
669 TkWindow *winPtr;
680670 XEvent xEvent;
681671
682672 dispPtr = TkGetDisplayList();
684674 if (rootwin == NULL) {
685675 tkwin = NULL;
686676 } else {
687 tkwin = Tk_TopCoordsToWindow(rootwin,
688 medPtr->local.h, medPtr->local.v,
689 &xEvent.xbutton.x, &xEvent.xbutton.y);
677 tkwin = Tk_TopCoordsToWindow(rootwin, medPtr->local.h,
678 medPtr->local.v, &xEvent.xbutton.x, &xEvent.xbutton.y);
690679 }
691680
692681 /*
693 * The following call will generate the appropiate X events and
694 * adjust any state that Tk must remember.
682 * The following call will generate the appropiate X events and adjust any
683 * state that Tk must remember.
695684 */
696685
697686 if (!tkwin) {
700689 if (!tkwin) {
701690 return false;
702691 }
692
703693 winPtr = (TkWindow *) tkwin;
704694 xEvent.type = MouseWheelEvent;
705695 xEvent.xkey.keycode = medPtr->delta;
711701 xEvent.xany.display = winPtr->display;
712702 xEvent.xany.window = Tk_WindowId(winPtr);
713703 Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
714
715704 return true;
716705 }
717706
721710 * TkMacOSXGetEatButtonUp --
722711 *
723712 * Results:
724 * Returns the flag indicating if we need to eat the
725 * next mouse up event
713 * Return the flag indicating if we need to eat the next mouse up event.
726714 *
727715 * Side effects:
728716 * None.
729717 *
730718 *----------------------------------------------------------------------
731719 */
720
732721 int
733722 TkMacOSXGetEatButtonUp(void)
734723 {
744733 * None.
745734 *
746735 * Side effects:
747 * Sets the flag indicating if we need to eat the
748 * next mouse up event
749 *
750 *----------------------------------------------------------------------
751 */
736 * Sets the flag indicating if we need to eat the next mouse up event
737 *
738 *----------------------------------------------------------------------
739 */
740
752741 void
753 TkMacOSXSetEatButtonUp(int f)
742 TkMacOSXSetEatButtonUp(
743 int f)
754744 {
755745 gEatButtonUp = f;
756746 }
780770 keyModifiers = isFrontProcess ? GetCurrentEventKeyModifiers() :
781771 GetCurrentKeyModifiers();
782772
783 return (EventModifiers)(keyModifiers & USHRT_MAX);
773 return (EventModifiers) (keyModifiers & USHRT_MAX);
784774 }
785775
786776 /*
791781 * Returns the current state of the button & modifier keys.
792782 *
793783 * Results:
794 * A bitwise inclusive OR of a subset of the following:
795 * Button1Mask, ShiftMask, LockMask, ControlMask, Mod*Mask.
784 * A bitwise inclusive OR of a subset of the following: Button1Mask,
785 * ShiftMask, LockMask, ControlMask, Mod*Mask.
796786 *
797787 * Side effects:
798788 * None.
834824 */
835825
836826 static unsigned int
837 ButtonModifiers2State(UInt32 buttonState, UInt32 keyModifiers)
827 ButtonModifiers2State(
828 UInt32 buttonState,
829 UInt32 keyModifiers)
838830 {
839831 unsigned int state;
840832
841 /* Tk supports at most 5 buttons */
833 /*
834 * Tk supports at most 5 buttons.
835 */
836
842837 state = (buttonState & ((1<<5) - 1)) << 8;
843838
844839 if (keyModifiers & alphaLock) {
872867 * XQueryPointer --
873868 *
874869 * Check the current state of the mouse. This is not a complete
875 * implementation of this function. It only computes the root
876 * coordinates and the current mask.
877 *
878 * Results:
879 * Sets root_x_return, root_y_return, and mask_return. Returns
880 * true on success.
870 * implementation of this function. It only computes the root coordinates
871 * and the current mask.
872 *
873 * Results:
874 * Sets root_x_return, root_y_return, and mask_return. Returns true on
875 * success.
881876 *
882877 * Side effects:
883878 * None.
887882
888883 Bool
889884 XQueryPointer(
890 Display* display,
885 Display *display,
891886 Window w,
892 Window* root_return,
893 Window* child_return,
894 int* root_x_return,
895 int* root_y_return,
896 int* win_x_return,
897 int* win_y_return,
898 unsigned int* mask_return)
887 Window *root_return,
888 Window *child_return,
889 int *root_x_return,
890 int *root_y_return,
891 int *win_x_return,
892 int *win_y_return,
893 unsigned int *mask_return)
899894 {
900895 int getGlobal = (root_x_return && root_y_return);
901896 int getLocal = (win_x_return && win_y_return);
922917 }
923918 if (getLocal) {
924919 WindowRef whichWin;
920
925921 if (ev) {
926922 err = ChkErr(GetEventParameter, ev, kEventParamWindowRef,
927923 typeWindowRef, NULL, sizeof(WindowRef), NULL,
965961 *
966962 * TkGenerateButtonEventForXPointer --
967963 *
968 * This procedure generates an X button event for the current
969 * pointer state as reported by XQueryPointer().
964 * This procedure generates an X button event for the current pointer
965 * state as reported by XQueryPointer().
970966 *
971967 * Results:
972968 * True if event(s) are generated - false otherwise.
973969 *
974970 * Side effects:
975 * Additional events may be place on the Tk event queue.
976 * Grab state may also change.
971 * Additional events may be place on the Tk event queue. Grab state may
972 * also change.
977973 *
978974 *----------------------------------------------------------------------
979975 */
980976
981977 MODULE_SCOPE int
982978 TkGenerateButtonEventForXPointer(
983 Window window) /* X Window containing button event. */
979 Window window) /* X Window containing button event. */
984980 {
985981 MouseEventData med;
986982 int global_x, global_y, local_x, local_y;
1003999 *
10041000 * TkGenerateButtonEvent --
10051001 *
1006 * Given a global x & y position and the button key status this
1007 * procedure generates the appropiate X button event. It also
1008 * handles the state changes needed to implement implicit grabs.
1009 *
1010 * Results:
1011 * True if event(s) are generated - false otherwise.
1012 *
1013 * Side effects:
1014 * Additional events may be place on the Tk event queue.
1015 * Grab state may also change.
1002 * Given a global x & y position and the button key status this procedure
1003 * generates the appropiate X button event. It also handles the state
1004 * changes needed to implement implicit grabs.
1005 *
1006 * Results:
1007 * True if event(s) are generated, false otherwise.
1008 *
1009 * Side effects:
1010 * Additional events may be place on the Tk event queue. Grab state may
1011 * also change.
10161012 *
10171013 *----------------------------------------------------------------------
10181014 */
10191015
10201016 int
10211017 TkGenerateButtonEvent(
1022 int x, /* X location of mouse */
1023 int y, /* Y location of mouse */
1024 Window window, /* X Window containing button event. */
1025 unsigned int state) /* Button Key state suitable for X event */
1018 int x, /* X location of mouse, */
1019 int y, /* Y location of mouse. */
1020 Window window, /* X Window containing button event. */
1021 unsigned int state) /* Button Key state suitable for X event. */
10261022 {
10271023 MouseEventData med;
10281024
10441040 *
10451041 * GenerateButtonEvent --
10461042 *
1047 * Generate an X button event from a MouseEventData structure.
1048 * Handles the state changes needed to implement implicit grabs.
1043 * Generate an X button event from a MouseEventData structure. Handles
1044 * the state changes needed to implement implicit grabs.
10491045 *
10501046 * Results:
10511047 * True if event(s) are generated - false otherwise.
10521048 *
10531049 * Side effects:
1054 * Additional events may be place on the Tk event queue.
1055 * Grab state may also change.
1050 * Additional events may be place on the Tk event queue. Grab state may
1051 * also change.
10561052 *
10571053 *----------------------------------------------------------------------
10581054 */
10591055
10601056 static int
1061 GenerateButtonEvent(MouseEventData * medPtr)
1057 GenerateButtonEvent(
1058 MouseEventData *medPtr)
10621059 {
10631060 Tk_Window tkwin;
10641061 int dummy;
10661063
10671064 #if UNUSED
10681065 /*
1069 * ButtonDown events will always occur in the front
1070 * window. ButtonUp events, however, may occur anywhere
1071 * on the screen. ButtonUp events should only be sent
1072 * to Tk if in the front window or during an implicit grab.
1066 * ButtonDown events will always occur in the front window. ButtonUp
1067 * events, however, may occur anywhere on the screen. ButtonUp events
1068 * should only be sent to Tk if in the front window or during an implicit
1069 * grab.
10731070 */
1071
10741072 if ((medPtr->activeNonFloating == NULL)
10751073 || ((!(TkpIsWindowFloating(medPtr->whichWin))
10761074 && (medPtr->activeNonFloating != medPtr->whichWin))
10881086 }
10891087
10901088 Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v, medPtr->state);
1091
10921089 return true;
10931090 }
10941091
10971094 *
10981095 * GenerateToolbarButtonEvent --
10991096 *
1100 * Generates a "ToolbarButton" virtual event.
1101 * This can be used to manage disappearing toolbars.
1097 * Generates a "ToolbarButton" virtual event. This can be used to manage
1098 * disappearing toolbars.
11021099 *
11031100 * Results:
11041101 * None.
11101107 */
11111108
11121109 static int
1113 GenerateToolbarButtonEvent(MouseEventData * medPtr)
1110 GenerateToolbarButtonEvent(
1111 MouseEventData *medPtr)
11141112 {
11151113 Tk_Window rootwin, tkwin = NULL;
11161114 TkDisplay *dispPtr;
1117 TkWindow *winPtr;
1115 TkWindow *winPtr;
11181116 XVirtualEvent event;
11191117
11201118 dispPtr = TkGetDisplayList();
11261124 if (!tkwin) {
11271125 return true;
11281126 }
1129 winPtr = (TkWindow *)tkwin;
1127 winPtr = (TkWindow *) tkwin;
11301128
11311129 bzero(&event, sizeof(XVirtualEvent));
11321130 event.type = VirtualEvent;
11461144 Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
11471145 return true;
11481146 }
1147
1148 /*
1149 * Local Variables:
1150 * mode: c
1151 * c-basic-offset: 4
1152 * fill-column: 79
1153 * coding: utf-8
1154 * End:
1155 */
1010 * See the file "license.terms" for information on usage and redistribution
1111 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.20 2007/12/13 15:27:10 dgp Exp $
13 * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.21 2008/11/08 18:44:40 dkf Exp $
1414 */
1515
1616 #include "tkMacOSXPrivate.h"
3030 static void TkMacOSXNotifyExitHandler(ClientData clientData);
3131 static void CarbonEventsSetupProc(ClientData clientData, int flags);
3232 static void CarbonEventsCheckProc(ClientData clientData, int flags);
33
34 /*
33
34 /*
3535 *----------------------------------------------------------------------
3636 *
3737 * Tk_MacOSXSetupTkNotifier --
6565 GetMainEventQueue();
6666
6767 tsdPtr->initialized = 1;
68 /* Install Carbon events event source in main event loop thread. */
68
69 /*
70 * Install Carbon events event source in main event loop thread.
71 */
72
6973 if (GetCurrentEventLoop() == GetMainEventLoop()) {
7074 if (!pthread_main_np()) {
7175 /*
72 * Panic if the Carbon main event loop thread (i.e. the
73 * thread where HIToolbox was first loaded) is not the
74 * main application thread, as Carbon does not support
75 * this properly.
76 * Panic if the Carbon main event loop thread (i.e. the thread
77 * where HIToolbox was first loaded) is not the main
78 * application thread, as Carbon does not support this
79 * properly.
7680 */
81
7782 Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s",
7883 "first [load] of TkAqua has to occur in the main thread!");
7984 }
102107 */
103108
104109 static void
105 TkMacOSXNotifyExitHandler(clientData)
106 ClientData clientData; /* Not used. */
110 TkMacOSXNotifyExitHandler(
111 ClientData clientData) /* Not used. */
107112 {
108113 ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey,
109114 sizeof(ThreadSpecificData));
118123 *
119124 * CarbonEventsSetupProc --
120125 *
121 * This procedure implements the setup part of the Carbon Events
122 * event source. It is invoked by Tcl_DoOneEvent before entering
123 * the notifier to check for events.
126 * This procedure implements the setup part of the Carbon Events event
127 * source. It is invoked by Tcl_DoOneEvent before entering the notifier
128 * to check for events.
124129 *
125130 * Results:
126131 * None.
127132 *
128133 * Side effects:
129 * If Carbon events are queued, then the maximum block time will be
130 * set to 0 to ensure that the notifier returns control to Tcl.
134 * If Carbon events are queued, then the maximum block time will be set
135 * to 0 to ensure that the notifier returns control to Tcl.
131136 *
132137 *----------------------------------------------------------------------
133138 */
134139
135140 static void
136 CarbonEventsSetupProc(clientData, flags)
137 ClientData clientData;
138 int flags;
141 CarbonEventsSetupProc(
142 ClientData clientData,
143 int flags)
139144 {
140145 static Tcl_Time blockTime = { 0, 0 };
141146
143148 return;
144149 }
145150
146 if (GetNumEventsInQueue((EventQueueRef)clientData)) {
151 if (GetNumEventsInQueue((EventQueueRef) clientData)) {
147152 Tcl_SetMaxBlockTime(&blockTime);
148153 }
149154 }
153158 *
154159 * CarbonEventsCheckProc --
155160 *
156 * This procedure processes events sitting in the Carbon event
157 * queue.
161 * This procedure processes events sitting in the Carbon event queue.
158162 *
159163 * Results:
160164 * None.
166170 */
167171
168172 static void
169 CarbonEventsCheckProc(clientData, flags)
170 ClientData clientData;
171 int flags;
173 CarbonEventsCheckProc(
174 ClientData clientData,
175 int flags)
172176 {
173177 int numFound;
174178 OSStatus err = noErr;
177181 return;
178182 }
179183
180 numFound = GetNumEventsInQueue((EventQueueRef)clientData);
184 numFound = GetNumEventsInQueue((EventQueueRef) clientData);
181185
182 /* Avoid starving other event sources: */
186 /*
187 * Avoid starving other event sources:
188 */
189
183190 if (numFound > 4) {
184191 numFound = 4;
185192 }
1111 * See the file "license.terms" for information on usage and redistribution
1212 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkMacOSXPort.h,v 1.14 2008/08/19 15:52:13 georgeps Exp $
14 * RCS: @(#) $Id: tkMacOSXPort.h,v 1.15 2008/12/17 22:51:25 nijtmans Exp $
1515 */
1616
1717 #ifndef _TKMACPORT
1818 #define _TKMACPORT
19
20 /*
21 * Macro to use instead of "void" for arguments that must have
22 * type "void *" in ANSI C; maps them to type "char *" in
23 * non-ANSI systems. This macro may be used in some of the include
24 * files below, which is why it is defined here.
25 */
26
27 #ifndef VOID
28 # ifdef __STDC__
29 # define VOID void
30 # else
31 # define VOID char
32 # endif
33 #endif
3419
3520 #include <stdio.h>
3621 #include <ctype.h>
77 * See the file "license.terms" for information on usage and redistribution
88 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkMacOSXPrivate.h,v 1.8 2008/09/02 16:10:55 das Exp $
10 * RCS: @(#) $Id: tkMacOSXPrivate.h,v 1.9 2008/10/27 11:55:45 dkf Exp $
1111 */
1212
1313 #ifndef _TKMACPRIV
1616 #ifndef _TKMACINT
1717 #include "tkMacOSXInt.h"
1818 #endif
19
19
2020 /* Define constants only available on Mac OS X 10.3 or later */
2121 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
2222 #define kEventAppAvailableWindowBoundsChanged 110
171171 #define tk_if_mac_os_x_10_5 tk_if_mac_os_x_no
172172 #define tk_else_mac_os_x_10_5 tk_else_mac_os_x_no
173173 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
174
174
175175 /*
176176 * Macros for DEBUG_ASSERT_MESSAGE et al from Debugging.h.
177177 */
189189 /*
190190 * Macro to do debug message output.
191191 */
192 #define TkMacOSXDbgMsg(m, ...) do { \
193 fprintf(stderr, "%s:%d: %s(): " m "\n", strrchr(__FILE__, '/')+1, \
194 __LINE__, __func__, ##__VA_ARGS__); \
195 } while (0)
192 #define TkMacOSXDbgMsg(m, ...) \
193 do { \
194 fprintf(stderr, "%s:%d: %s(): " m "\n", strrchr(__FILE__, '/')+1, \
195 __LINE__, __func__, ##__VA_ARGS__); \
196 } while (0)
197
196198 /*
197199 * Macro to do debug API failure message output.
198200 */
199201 #if !defined(DEBUGLEVEL) || !DEBUGLEVEL
200 #define TkMacOSXDbgOSErr(f, err) do { \
201 TkMacOSXDbgMsg("%s failed: %ld", #f, err); \
202 } while (0)
202 #define TkMacOSXDbgOSErr(f, err) \
203 do { \
204 TkMacOSXDbgMsg("%s failed: %ld", #f, err); \
205 } while (0)
203206 #else
204 #define TkMacOSXDbgOSErr(f, err) do { \
205 DEBUG_ASSERT_MESSAGE(kComponentSignatureString, #f " failed:", \
206 __func__, 0, strrchr(__FILE__, '/')+1, __LINE__, err); \
207 } while (0)
208 #endif
207 #define TkMacOSXDbgOSErr(f, err) \
208 do { \
209 DEBUG_ASSERT_MESSAGE(kComponentSignatureString, #f " failed:", \
210 __func__, 0, strrchr(__FILE__, '/')+1, __LINE__, err); \
211 } while (0)
212 #endif
213
209214 /*
210215 * Macro to do very common check for noErr return from given API and output
211216 * debug message in case of failure.
216221 TkMacOSXDbgOSErr(f, err); \
217222 } \
218223 err;})
224
219225 /*
220226 * Macro to check emptyness of shared QD tmp region before use in debug builds.
221227 */
222 #define TkMacOSXCheckTmpQdRgnEmpty() do { \
223 if (!EmptyRgn(tkMacOSXtmpQdRgn)) { \
224 Tcl_Panic("tkMacOSXtmpQdRgn nonempty"); \
225 } \
226 } while(0)
228 #define TkMacOSXCheckTmpQdRgnEmpty() \
229 do { \
230 if (!EmptyRgn(tkMacOSXtmpQdRgn)) { \
231 Tcl_Panic("tkMacOSXtmpQdRgn nonempty"); \
232 } \
233 } while(0)
227234 #else /* TK_MAC_DEBUG */
228235 #define TkMacOSXDbgMsg(m, ...)
229236 #define TkMacOSXDbgOSErr(f, err)
241248 symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), \
242249 STRINGIFY(_##symbol)); \
243250 }
244 MODULE_SCOPE void* TkMacOSXGetNamedSymbol(const char* module,
245 const char* symbol);
246
251
247252 /*
248253 * Structure encapsulating current drawing environment.
249254 */
271276 */
272277
273278 #if 0
274 MODULE_SCOPE void TkMacOSXEmtpyRegion(TkRegion r);
275 MODULE_SCOPE int TkMacOSXIsEmptyRegion(TkRegion r);
276 #endif
277 MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r);
278 MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r, HIShapeRef rgn);
279 MODULE_SCOPE void TkMacOSXOffsetRegion(TkRegion r, short dx, short dy);
280 MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void);
279 MODULE_SCOPE void TkMacOSXEmtpyRegion(TkRegion r);
280 MODULE_SCOPE int TkMacOSXIsEmptyRegion(TkRegion r);
281 #endif
282 MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r);
283 MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r,
284 HIShapeRef rgn);
285 MODULE_SCOPE void TkMacOSXOffsetRegion(TkRegion r, short dx, short dy);
286 MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void);
281287 MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect(
282 const CGRect *inRect);
283 MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithShape(
284 HIMutableShapeRef inDestShape, HIShapeRef inSrcShape);
288 const CGRect *inRect);
289 MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithShape(
290 HIMutableShapeRef inDestShape,
291 HIShapeRef inSrcShape);
285292 #if 0
286 MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithRect(HIMutableShapeRef inShape,
287 const CGRect *inRect);
288 #endif
289 MODULE_SCOPE OSStatus TkMacOSHIShapeDifferenceWithRect(
290 HIMutableShapeRef inShape, const CGRect *inRect);
291 MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape,
292 const CGRect *inRect);
293 MODULE_SCOPE OSStatus TkMacOSHIShapeUnion(HIShapeRef inShape1,
294 HIShapeRef inShape2, HIMutableShapeRef outResult);
293 MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithRect(HIMutableShapeRef inShape,
294 const CGRect *inRect);
295 #endif
296 MODULE_SCOPE OSStatus TkMacOSHIShapeDifferenceWithRect(
297 HIMutableShapeRef inShape, const CGRect *inRect);
298 MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape,
299 const CGRect *inRect);
300 MODULE_SCOPE OSStatus TkMacOSHIShapeUnion(HIShapeRef inShape1,
301 HIShapeRef inShape2, HIMutableShapeRef outResult);
295302
296303 /*
297304 * Prototypes of TkAqua internal procs.
298305 */
299306
300 MODULE_SCOPE void TkMacOSXDisplayChanged(Display *display);
301 MODULE_SCOPE void TkMacOSXInitScrollbarMetrics(void);
302 MODULE_SCOPE int TkMacOSXUseAntialiasedText(Tcl_Interp *interp, int enable);
303 MODULE_SCOPE void TkMacOSXInitCarbonEvents(Tcl_Interp *interp);
304 MODULE_SCOPE int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable,
305 int antiAlias);
306 MODULE_SCOPE void TkMacOSXInitKeyboard(Tcl_Interp *interp);
307 MODULE_SCOPE int TkMacOSXGenerateFocusEvent(Window window, int activeFlag);
308 MODULE_SCOPE int TkMacOSXGenerateParentMenuSelectEvent(MenuRef menu);
309 MODULE_SCOPE int TkMacOSXGenerateMenuSelectEvent(MenuRef menu,
310 MenuItemIndex index);
311 MODULE_SCOPE void TkMacOSXClearActiveMenu(MenuRef menu);
307 MODULE_SCOPE void * TkMacOSXGetNamedSymbol(const char *module,
308 const char *symbol);
309 MODULE_SCOPE void TkMacOSXDisplayChanged(Display *display);
310 MODULE_SCOPE void TkMacOSXInitScrollbarMetrics(void);
311 MODULE_SCOPE int TkMacOSXUseAntialiasedText(Tcl_Interp *interp,
312 int enable);
313 MODULE_SCOPE void TkMacOSXInitCarbonEvents(Tcl_Interp *interp);
314 MODULE_SCOPE int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable,
315 int antiAlias);
316 MODULE_SCOPE void TkMacOSXInitKeyboard(Tcl_Interp *interp);
317 MODULE_SCOPE int TkMacOSXGenerateFocusEvent(Window window,
318 int activeFlag);
319 MODULE_SCOPE int TkMacOSXGenerateParentMenuSelectEvent(MenuRef menu);
320 MODULE_SCOPE int TkMacOSXGenerateMenuSelectEvent(MenuRef menu,
321 MenuItemIndex index);
322 MODULE_SCOPE void TkMacOSXClearActiveMenu(MenuRef menu);
312323 MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr);
313 MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr);
314 MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window);
324 MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr);
325 MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window);
315326 MODULE_SCOPE EventModifiers TkMacOSXModifierState(void);
316 MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG,
317 TkMacOSXDrawingContext *dcPtr);
318 MODULE_SCOPE void TkMacOSXRestoreDrawingContext(TkMacOSXDrawingContext *dcPtr);
319 MODULE_SCOPE void TkMacOSXSetColorInPort(unsigned long pixel, int fg,
320 PixPatHandle penPat, CGrafPtr port);
321 MODULE_SCOPE void TkMacOSXSetColorInContext(unsigned long pixel,
322 CGContextRef context);
323 MODULE_SCOPE int TkMacOSXRunTclEventLoop(void);
324 MODULE_SCOPE OSStatus TkMacOSXStartTclEventLoopCarbonTimer(void);
325 MODULE_SCOPE OSStatus TkMacOSXStopTclEventLoopCarbonTimer(void);
326 MODULE_SCOPE void TkMacOSXTrackingLoop(int tracking);
327 MODULE_SCOPE OSStatus TkMacOSXReceiveAndDispatchEvent(void);
328 MODULE_SCOPE void TkMacOSXInstallWindowCarbonEventHandler(Tcl_Interp *interp,
329 WindowRef window);
330 MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr, WindowRef window,
331 int fullscreen, Tcl_Interp *interp);
332 MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr, int active);
333 MODULE_SCOPE void TkMacOSXBringWindowForward(WindowRef wRef);
334 MODULE_SCOPE WindowRef TkMacOSXDrawableWindow(Drawable drawable);
335 MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds);
336 MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable);
337 MODULE_SCOPE Tcl_Obj* TkMacOSXGetStringObjFromCFString(CFStringRef str);
327 MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc,
328 int useCG, TkMacOSXDrawingContext *dcPtr);
329 MODULE_SCOPE void TkMacOSXRestoreDrawingContext(
330 TkMacOSXDrawingContext *dcPtr);
331 MODULE_SCOPE void TkMacOSXSetColorInPort(unsigned long pixel, int fg,
332 PixPatHandle penPat, CGrafPtr port);
333 MODULE_SCOPE void TkMacOSXSetColorInContext(unsigned long pixel,
334 CGContextRef context);
335 MODULE_SCOPE int TkMacOSXRunTclEventLoop(void);
336 MODULE_SCOPE OSStatus TkMacOSXStartTclEventLoopCarbonTimer(void);
337 MODULE_SCOPE OSStatus TkMacOSXStopTclEventLoopCarbonTimer(void);
338 MODULE_SCOPE void TkMacOSXTrackingLoop(int tracking);
339 MODULE_SCOPE OSStatus TkMacOSXReceiveAndDispatchEvent(void);
340 MODULE_SCOPE void TkMacOSXInstallWindowCarbonEventHandler(
341 Tcl_Interp *interp, WindowRef window);
342 MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr,
343 WindowRef window, int fullscreen,
344 Tcl_Interp *interp);
345 MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr,
346 int active);
347 MODULE_SCOPE void TkMacOSXBringWindowForward(WindowRef wRef);
348 MODULE_SCOPE WindowRef TkMacOSXDrawableWindow(Drawable drawable);
349 MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds);
350 MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable);
351 MODULE_SCOPE Tcl_Obj * TkMacOSXGetStringObjFromCFString(CFStringRef str);
338352
339353 #endif /* _TKMACPRIV */
66 * Copyright 2001, Apple Computer, Inc.
77 * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
88 *
9 * See the file "license.terms" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.11 2007/12/13 15:27:10 dgp Exp $
9 * See the file "license.terms" for information on usage and redistribution of
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.12 2008/10/27 11:55:45 dkf Exp $
1313 */
1414
1515 #include "tkMacOSXPrivate.h"
2020 *
2121 * TkCreateRegion --
2222 *
23 * Implements the equivelent of the X window function
24 * XCreateRegion. See X window documentation for more details.
23 * Implements the equivelent of the X window function XCreateRegion. See
24 * Xwindow documentation for more details.
2525 *
2626 * Results:
2727 * Returns an allocated region handle.
4343 *
4444 * TkDestroyRegion --
4545 *
46 * Implements the equivelent of the X window function
47 * XDestroyRegion. See X window documentation for more details.
46 * Implements the equivelent of the X window function XDestroyRegion. See
47 * Xwindow documentation for more details.
4848 *
4949 * Results:
5050 * None.
6969 *
7070 * TkIntersectRegion --
7171 *
72 * Implements the equivalent of the X window function
73 * XIntersectRegion. See X window documentation for more details.
72 * Implements the equivalent of the X window function XIntersectRegion.
73 * See Xwindow documentation for more details.
7474 *
7575 * Results:
7676 * None.
9696 *
9797 * TkSubtractRegion --
9898 *
99 * Implements the equivalent of the X window function
100 * XSubtractRegion. See X window documentation for more details.
99 * Implements the equivalent of the X window function XSubtractRegion.
100 * See X window documentation for more details.
101101 *
102102 * Results:
103103 * None.
124124 * TkUnionRectWithRegion --
125125 *
126126 * Implements the equivelent of the X window function
127 * XUnionRectWithRegion. See X window documentation for more
128 * details.
127 * XUnionRectWithRegion. See Xwindow documentation for more details.
129128 *
130129 * Results:
131130 * None.
162161 *
163162 * TkRectInRegion --
164163 *
165 * Implements the equivelent of the X window function
166 * XRectInRegion. See X window documentation for more details.
164 * Implements the equivelent of the X window function XRectInRegion. See
165 * Xwindow documentation for more details.
167166 *
168167 * Results:
169168 * Returns RectanglePart or RectangleOut. Note that this is not a
217216 #endif
218217 CFRelease(sectRgn);
219218 CFRelease(rectRgn);
220 ) TK_ENDIF
219 ) TK_ENDIF;
221220 return result;
222221 }
223222
226225 *
227226 * TkClipBox --
228227 *
229 * Implements the equivelent of the X window function XClipBox.
230 * See X window documentation for more details.
228 * Implements the equivelent of the X window function XClipBox. See
229 * Xwindow documentation for more details.
231230 *
232231 * Results:
233232 * None.
257256 *
258257 * TkpBuildRegionFromAlphaData --
259258 *
260 * Set up a rectangle of the given region based on the supplied
261 * alpha data.
259 * Set up a rectangle of the given region based on the supplied alpha
260 * data.
262261 *
263262 * Results:
264263 * None
289288 for (y1 = 0; y1 < height; y1++) {
290289 lineDataPtr = dataPtr;
291290 for (x1 = 0; x1 < width; x1 = end) {
292 /* search for first non-transparent pixel */
291 /*
292 * Search for first non-transparent pixel.
293 */
294
293295 while ((x1 < width) && !*lineDataPtr) {
294296 x1++;
295297 lineDataPtr += pixelStride;
296298 }
297299 end = x1;
298 /* search for first transparent pixel */
300
301 /*
302 * Search for first transparent pixel.
303 */
304
299305 while ((end < width) && *lineDataPtr) {
300306 end++;
301307 lineDataPtr += pixelStride;
508514 CFRelease(rgn);
509515 }
510516 result = HIShapeCreateCopy(emptyRgn);
511 ) TK_ENDIF
517 ) TK_ENDIF;
512518
513519 return result;
514520 }
526532
527533 result = HIShapeCreateMutableCopy(rgn);
528534 CFRelease(rgn);
529 ) TK_ENDIF
535 ) TK_ENDIF;
530536
531537 return result;
532538 }
545551 if (result == noErr) {
546552 result = HIShapeDifference(inSrcShape, inDestShape, inDestShape);
547553 }
548 ) TK_ENDIF
554 ) TK_ENDIF;
549555
550556 return result;
551557 }
594600
595601 result = TkMacOSHIShapeUnion(rgn, inShape, inShape);
596602 CFRelease(rgn);
597 ) TK_ENDIF
603 ) TK_ENDIF;
598604
599605 return result;
600606 }
610616 TK_IF_HI_TOOLBOX (4,
611617 result = HIShapeUnion(inShape1, inShape2, outResult);
612618 ) TK_ELSE_HI_TOOLBOX (4,
613 /* Workaround HIShapeUnion bug in 10.3 and earlier */
619 /*
620 * Workaround HIShapeUnion bug in 10.3 and earlier.
621 */
622
614623 HIShapeRef rgn = HIShapeCreateCopy(outResult);
615624
616625 result = HIShapeUnion(inShape1, inShape2, (HIMutableShapeRef) rgn);
621630 }
622631 }
623632 CFRelease(rgn);
624 ) TK_ENDIF
625
626 return result;
627 }
633 ) TK_ENDIF;
634
635 return result;
636 }
637
638 /*
639 * Local Variables:
640 * mode: c
641 * c-basic-offset: 4
642 * fill-column: 78
643 * coding: utf-8
644 * End:
645 */
1010 * See the file "license.terms" for information on usage and redistribution
1111 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkMacOSXScale.c,v 1.15 2007/12/13 15:27:10 dgp Exp $
13 * RCS: @(#) $Id: tkMacOSXScale.c,v 1.16 2008/12/09 21:22:56 dgp Exp $
1414 */
1515
1616 #include "tkMacOSXPrivate.h"
173173 result = Tcl_VarEval(interp, scalePtr->command, " ", string, NULL);
174174 if (result != TCL_OK) {
175175 Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
176 Tcl_BackgroundError(interp);
176 Tcl_BackgroundException(interp, result);
177177 }
178178 Tcl_Release((ClientData) interp);
179179 }
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.27 2008/10/03 13:13:31 dkf Exp $
14 * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.29 2008/12/07 16:36:26 das Exp $
1515 */
1616
1717 #include "tkMacOSXPrivate.h"
327327 */
328328
329329 void
330 TkpConfigureScrollbar(scrollPtr)
331 register TkScrollbar *scrollPtr; /* Information about widget; may or
332 * may not already have values for
333 * some fields. */
330 TkpConfigureScrollbar(
331 register TkScrollbar *scrollPtr)
332 /* Information about widget; may or may not
333 * already have values for some fields. */
334334 {
335335 }
336336
553553 */
554554
555555 static pascal void
556 ThumbActionProc(ControlRef theControl, ControlPartCode partCode)
556 ThumbActionProc(
557 ControlRef theControl,
558 ControlPartCode partCode)
557559 {
558560 TkScrollbar *scrollPtr = (TkScrollbar *)(intptr_t)
559561 GetControlReference(theControl);
560562 MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr;
561563 Tcl_DString cmdString;
562 int origValue, variant;
564 /*int origValue;*/ /* dead code */
565 int variant;
563566 short trackBarSize;
564567 double oldFirstFraction, newFirstFraction;
565568 char valueString[40];
574577 }
575578
576579 Tcl_DStringInit(&cmdString);
577 origValue = GetControl32BitValue(macScrollPtr->sbHandle);
580 /*origValue = GetControl32BitValue(macScrollPtr->sbHandle);*/ /* dead code */
578581 GetControlBounds(macScrollPtr->sbHandle, &trackRect);
579582
580583 if (scrollPtr->vertical) {
786789
787790 mouseDownPoint.h = where.h;
788791 mouseDownPoint.v = where.v;
789 part = HandleControlClick(macScrollPtr->sbHandle, where,
792 HandleControlClick(macScrollPtr->sbHandle, where,
790793 TkMacOSXModifierState(), thumbActionProc);
791794 } else if (part == kAppearancePartIndicator) {
792795 /*
2929 * See the file "license.terms" for information on usage and redistribution of
3030 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
3131 *
32 * RCS: @(#) $Id: tkMacOSXSend.c,v 1.10 2008/07/23 23:24:44 nijtmans Exp $
32 * RCS: @(#) $Id: tkMacOSXSend.c,v 1.12 2008/12/07 16:36:26 das Exp $
3333 */
3434
3535 #include "tkMacOSXInt.h"
255255 Tcl_IncrRefCount(resultObjPtr);
256256 for (i = 0; ; ) {
257257 result = Tcl_ListObjIndex(NULL, resultObjPtr, i, &interpNamePtr);
258 if (interpNamePtr == NULL) {
258 if (result != TCL_OK || interpNamePtr == NULL) {
259259 break;
260260 }
261261 interpName = Tcl_GetString(interpNamePtr);
326326 int objc, /* Number of arguments */
327327 Tcl_Obj *const objv[]) /* The arguments */
328328 {
329 const char *sendOptions[] = {"-async", "-displayof", "-", NULL};
329 const char *const sendOptions[] = {"-async", "-displayof", "-", NULL};
330330 char *stringRep, *destName;
331 int async = 0;
331 /*int async = 0;*/
332332 int i, index, firstArg;
333333 RegisteredInterp *riPtr;
334 Tcl_Obj *resultPtr, *listObjPtr;
334 Tcl_Obj *listObjPtr;
335335 int result = TCL_OK;
336336
337337 for (i = 1; i < (objc - 1); ) {
342342 return TCL_ERROR;
343343 }
344344 if (index == 0) {
345 async = 1;
345 /*async = 1;*/
346346 i++;
347347 } else if (index == 1) {
348348 i += 2;
362362
363363 destName = Tcl_GetString(objv[i]);
364364 firstArg = i + 1;
365
366 resultPtr = Tcl_GetObjResult(interp);
367365
368366 /*
369367 * See if the target interpreter is local. If so, execute the command
66 * Copyright 2001, Apple Computer, Inc.
77 * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
88 *
9 * See the file "license.terms" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.28 2008/06/19 00:14:10 das Exp $
9 * See the file "license.terms" for information on usage and redistribution of
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.29 2008/10/27 11:55:45 dkf Exp $
1313 */
1414
1515 #include "tkMacOSXPrivate.h"
2626 * Prototypes for functions used only in this file.
2727 */
2828
29 static void MoveResizeWindow(MacDrawable *macWin);
30 static void GenerateConfigureNotify(TkWindow *winPtr, int includeWin);
31 static void UpdateOffsets(TkWindow *winPtr, int deltaX, int deltaY);
32 static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr);
33
29 static void MoveResizeWindow(MacDrawable *macWin);
30 static void GenerateConfigureNotify(TkWindow *winPtr,
31 int includeWin);
32 static void UpdateOffsets(TkWindow *winPtr, int deltaX,
33 int deltaY);
34 static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr);
35
36 /*
37 *----------------------------------------------------------------------
38 *
39 * AllocGWorld --
40 * Simplifies the allocation of new drawable ports.
41 *
42 *----------------------------------------------------------------------
43 */
44
45 static inline void
46 AllocGWorld(
47 int width,
48 int height,
49 int mono,
50 CGrafPtr *grafPtrPtr)
51 {
52 Rect bounds = {0, 0, height, width};
53
54 #ifdef __LITTLE_ENDIAN__
55 ChkErr(NewGWorld, grafPtrPtr, mono ? 1 : 0, &bounds, NULL, NULL,
56 kNativeEndianPixMap);
57 #else
58 ChkErr(NewGWorld, grafPtrPtr, mono ? 1 : 0, &bounds, NULL, NULL, 0);
59 #endif
60 }
3461
3562 /*
3663 *----------------------------------------------------------------------
5077
5178 void
5279 XDestroyWindow(
53 Display* display, /* Display. */
80 Display *display, /* Display. */
5481 Window window) /* Window. */
5582 {
5683 MacDrawable *macWin = (MacDrawable *) window;
84 WindowRef winRef;
5785
5886 /*
59 * Remove any dangling pointers that may exist if
60 * the window we are deleting is being tracked by
61 * the grab code.
87 * Remove any dangling pointers that may exist if the window we are
88 * deleting is being tracked by the grab code.
6289 */
6390
6491 TkPointerDeadWindow(macWin->winPtr);
6592 macWin->toplevel->referenceCount--;
6693
67 if (Tk_IsTopLevel(macWin->winPtr)) {
68 WindowRef winRef;
69 /*
70 * We are relying on the Activate Mac OS event to pass the
71 * focus away from a window that is getting Destroyed to the
72 * Front non-floating window. BUT we don't get activate events
73 * when a floating window is destroyed - since the front non-floating
74 * window doesn't in fact get activated... So maybe we can check here
75 * and if we are destroying a floating window, we can pass the focus
76 * back to the front non-floating window...
77 */
78
79 if (macWin->grafPtr != NULL) {
80 TkWindow *focusPtr = TkGetFocusWin(macWin->winPtr);
81 if (focusPtr == NULL || (focusPtr->mainPtr->winPtr == macWin->winPtr)) {
82 winRef = TkMacOSXDrawableWindow(window);
83 if (TkpIsWindowFloating (winRef)) {
84 Window window;
85
86 window = TkMacOSXGetXWindow(ActiveNonFloatingWindow());
87 if (window != None) {
88 TkMacOSXGenerateFocusEvent(window, 1);
89 }
90 }
91 }
92 }
93 if (macWin->visRgn) {
94 CFRelease(macWin->visRgn);
95 }
96 if (macWin->aboveVisRgn) {
97 CFRelease(macWin->aboveVisRgn);
98 }
99
100 /*
101 * Delete the Mac window and remove it from the windowTable.
102 * The window could be NULL if the window was never mapped.
103 * However, we don't do this for embedded windows, they don't
104 * go in the window list, and they do not own their portPtr's.
105 */
106
107 if (!(Tk_IsEmbedded(macWin->winPtr))) {
108 WindowRef winRef = TkMacOSXDrawableWindow(window);
109
110 if (winRef) {
111 TkMacOSXWindowList *listPtr, *prevPtr;
112 WindowGroupRef group;
113
114 if (GetWindowProperty(winRef, 'Tk ', 'TsGp', sizeof(group),
115 NULL, &group) == noErr) {
116 TkDisplay *dispPtr = TkGetDisplayList();
117 ItemCount i = CountWindowGroupContents(group,
118 kWindowGroupContentsReturnWindows);
119
120 while (i > 0) {
121 WindowRef macWin;
122
123 ChkErr(GetIndexedWindow, group, i--, 0, &macWin);
124 if (macWin) {
125 WindowGroupRef newGroup = NULL;
126 Window window = TkMacOSXGetXWindow(macWin);
127
128 if (window != None) {
129 TkWindow * winPtr = (TkWindow *)Tk_IdToWindow(
130 dispPtr->display, window);
131
132 if (winPtr && winPtr->wmInfoPtr) {
133 newGroup = GetWindowGroupOfClass(
134 winPtr->wmInfoPtr->macClass);
135 }
136 }
137 if (!newGroup) {
138 newGroup = GetWindowGroupOfClass(
139 kDocumentWindowClass);
140 }
141 ChkErr(SetWindowGroup, macWin, newGroup);
142 }
143
144 }
145 ChkErr(SetWindowGroupOwner, group, NULL);
146 ChkErr(ReleaseWindowGroup, group);
147 }
148 TkMacOSXUnregisterMacWindow(winRef);
149 DisposeWindow(winRef);
150
151 for (listPtr = tkMacOSXWindowListPtr, prevPtr = NULL;
152 tkMacOSXWindowListPtr != NULL;
153 prevPtr = listPtr, listPtr = listPtr->nextPtr) {
154 if (listPtr->winPtr == macWin->winPtr) {
155 if (prevPtr == NULL) {
156 tkMacOSXWindowListPtr = listPtr->nextPtr;
157 } else {
158 prevPtr->nextPtr = listPtr->nextPtr;
159 }
160 ckfree((char *) listPtr);
161 break;
162 }
163 }
164 }
165 }
166
167 macWin->grafPtr = NULL;
168
169 /*
170 * Delay deletion of a toplevel data structure untill all
171 * children have been deleted.
172 */
173 if (macWin->toplevel->referenceCount == 0) {
174 ckfree((char *) macWin->toplevel);
175 }
176 } else {
94 if (!Tk_IsTopLevel(macWin->winPtr)) {
17795 TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
17896 if (macWin->winPtr->parentPtr != NULL) {
17997 TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
189107 ckfree((char *) macWin->toplevel);
190108 }
191109 ckfree((char *) macWin);
110 return;
111 }
112
113 /*
114 * We are relying on the Activate Mac OS event to pass the focus away from
115 * a window that is getting Destroyed to the Front non-floating window. BUT
116 * we don't get activate events when a floating window is destroyed, since
117 * the front non-floating window doesn't in fact get activated... So maybe
118 * we can check here and if we are destroying a floating window, we can
119 * pass the focus back to the front non-floating window...
120 */
121
122 if (macWin->grafPtr != NULL) {
123 TkWindow *focusPtr = TkGetFocusWin(macWin->winPtr);
124
125 if (focusPtr == NULL
126 || (focusPtr->mainPtr->winPtr == macWin->winPtr)) {
127 winRef = TkMacOSXDrawableWindow(window);
128 if (TkpIsWindowFloating (winRef)) {
129 Window window = TkMacOSXGetXWindow(ActiveNonFloatingWindow());
130
131 if (window != None) {
132 TkMacOSXGenerateFocusEvent(window, 1);
133 }
134 }
135 }
136 }
137 if (macWin->visRgn) {
138 CFRelease(macWin->visRgn);
139 }
140 if (macWin->aboveVisRgn) {
141 CFRelease(macWin->aboveVisRgn);
142 }
143
144 /*
145 * Delete the Mac window and remove it from the windowTable. The window
146 * could be NULL if the window was never mapped. However, we don't do this
147 * for embedded windows, they don't go in the window list, and they do not
148 * own their portPtr's.
149 */
150
151 if (!Tk_IsEmbedded(macWin->winPtr)) {
152 WindowRef winRef = TkMacOSXDrawableWindow(window);
153
154 if (winRef) {
155 TkMacOSXWindowList *listPtr, *prevPtr;
156 WindowGroupRef group;
157
158 if (GetWindowProperty(winRef, 'Tk ', 'TsGp', sizeof(group), NULL,
159 &group) == noErr) {
160 TkDisplay *dispPtr = TkGetDisplayList();
161 ItemCount i = CountWindowGroupContents(group,
162 kWindowGroupContentsReturnWindows);
163 WindowRef macWin;
164 WindowGroupRef newGroup;
165 Window window;
166
167 while (i > 0) {
168 ChkErr(GetIndexedWindow, group, i--, 0, &macWin);
169 if (!macWin) {
170 continue;
171 }
172
173 window = TkMacOSXGetXWindow(macWin);
174 newGroup = NULL;
175 if (window != None) {
176 TkWindow *winPtr = (TkWindow *)
177 Tk_IdToWindow(dispPtr->display, window);
178
179 if (winPtr && winPtr->wmInfoPtr) {
180 newGroup = GetWindowGroupOfClass(
181 winPtr->wmInfoPtr->macClass);
182 }
183 }
184 if (!newGroup) {
185 newGroup =
186 GetWindowGroupOfClass(kDocumentWindowClass);
187 }
188 ChkErr(SetWindowGroup, macWin, newGroup);
189 }
190 ChkErr(SetWindowGroupOwner, group, NULL);
191 ChkErr(ReleaseWindowGroup, group);
192 }
193 TkMacOSXUnregisterMacWindow(winRef);
194 DisposeWindow(winRef);
195
196 for (listPtr=tkMacOSXWindowListPtr, prevPtr=NULL;
197 tkMacOSXWindowListPtr != NULL;
198 prevPtr=listPtr, listPtr=listPtr->nextPtr) {
199 if (listPtr->winPtr == macWin->winPtr) {
200 if (prevPtr == NULL) {
201 tkMacOSXWindowListPtr = listPtr->nextPtr;
202 } else {
203 prevPtr->nextPtr = listPtr->nextPtr;
204 }
205 ckfree((char *) listPtr);
206 break;
207 }
208 }
209 }
210 }
211
212 macWin->grafPtr = NULL;
213
214 /*
215 * Delay deletion of a toplevel data structure untill all children have
216 * been deleted.
217 */
218
219 if (macWin->toplevel->referenceCount == 0) {
220 ckfree((char *) macWin->toplevel);
192221 }
193222 }
194223
197226 *
198227 * XMapWindow --
199228 *
200 * Map the given X Window to the screen. See X window documentation
201 * for more details.
229 * Map the given X Window to the screen. See X window documentation for
230 * more details.
202231 *
203232 * Results:
204233 * None.
211240
212241 void
213242 XMapWindow(
214 Display* display, /* Display. */
243 Display *display, /* Display. */
215244 Window window) /* Window. */
216245 {
217246 MacDrawable *macWin = (MacDrawable *) window;
218247 XEvent event;
219248
220249 /*
221 * Under certain situations it's possible for this function to be
222 * called before the toplevel window it's associated with has actually
223 * been mapped. In that case we need to create the real Macintosh
224 * window now as this function as well as other X functions assume that
225 * the portPtr is valid.
250 * Under certain situations it's possible for this function to be called
251 * before the toplevel window it's associated with has actually been
252 * mapped. In that case we need to create the real Macintosh window now as
253 * this function as well as other X functions assume that the portPtr is
254 * valid.
226255 */
256
227257 if (!TkMacOSXHostToplevelExists(macWin->toplevel->winPtr)) {
228258 TkMacOSXMakeRealWindowExist(macWin->toplevel->winPtr);
229259 }
236266 * XXX This should be ShowSheetWindow for kSheetWindowClass
237267 * XXX windows that have a wmPtr->master parent set.
238268 */
269
239270 WindowRef wRef = TkMacOSXDrawableWindow(window);
240271
241272 if ((macWin->winPtr->wmInfoPtr->macClass == kSheetWindowClass)
249280 TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr);
250281
251282 /*
252 * We only need to send the MapNotify event
253 * for toplevel windows.
283 * We only need to send the MapNotify event for toplevel windows.
254284 */
255285
256286 event.xany.serial = display->request;
264294 Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
265295 } else {
266296 /*
267 * Generate damage for that area of the window
297 * Generate damage for that area of the window.
268298 */
269299
270300 TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
321351 *
322352 * XUnmapWindow --
323353 *
324 * Unmap the given X Window to the screen. See X window
325 * documentation for more details.
354 * Unmap the given X Window to the screen. See X window documentation for
355 * more details.
326356 *
327357 * Results:
328358 * None.
335365
336366 void
337367 XUnmapWindow(
338 Display* display, /* Display. */
368 Display *display, /* Display. */
339369 Window window) /* Window. */
340370 {
341371 MacDrawable *macWin = (MacDrawable *) window;
344374 display->request++;
345375 macWin->winPtr->flags &= ~TK_MAPPED;
346376 if (Tk_IsTopLevel(macWin->winPtr)) {
347 if (!Tk_IsEmbedded(macWin->winPtr)
348 && macWin->winPtr->wmInfoPtr->hints.initial_state != IconicState) {
377 if (!Tk_IsEmbedded(macWin->winPtr) &&
378 macWin->winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
349379 /*
350380 * XXX This should be HideSheetWindow for kSheetWindowClass
351381 * XXX windows that have a wmPtr->master parent set.
352382 */
383
353384 WindowRef wref = TkMacOSXDrawableWindow(window);
354385
355386 if ((macWin->winPtr->wmInfoPtr->macClass == kSheetWindowClass)
362393 TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr);
363394
364395 /*
365 * We only need to send the UnmapNotify event
366 * for toplevel windows.
396 * We only need to send the UnmapNotify event for toplevel windows.
367397 */
398
368399 event.xany.serial = display->request;
369400 event.xany.send_event = False;
370401 event.xany.display = display;
389420 *
390421 * XResizeWindow --
391422 *
392 * Resize a given X window. See X windows documentation for
393 * further details.
423 * Resize a given X window. See X windows documentation for further
424 * details.
394425 *
395426 * Results:
396427 * None.
403434
404435 void
405436 XResizeWindow(
406 Display* display, /* Display. */
437 Display *display, /* Display. */
407438 Window window, /* Window. */
408439 unsigned int width,
409440 unsigned int height)
446477
447478 void
448479 XMoveResizeWindow(
449 Display* display, /* Display. */
480 Display *display, /* Display. */
450481 Window window, /* Window. */
451482 int x, int y,
452483 unsigned int width,
453484 unsigned int height)
454485 {
455 MacDrawable * macWin = (MacDrawable *) window;
486 MacDrawable *macWin = (MacDrawable *) window;
456487
457488 display->request++;
458489 if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
491522
492523 void
493524 XMoveWindow(
494 Display* display, /* Display. */
525 Display *display, /* Display. */
495526 Window window, /* Window. */
496 int x,
497 int y)
527 int x, int y)
498528 {
499529 MacDrawable *macWin = (MacDrawable *) window;
500530
537567 /*
538568 * Find the Parent window, for an embedded window it will be its container.
539569 */
570
540571 if (Tk_IsEmbedded(macWin->winPtr)) {
541572 TkWindow *contWinPtr = TkpGetOtherWindow(macWin->winPtr);
542573
544575 macParent = contWinPtr->privatePtr;
545576 } else {
546577 /*
547 * Here we should handle out of process embedding.
548 * At this point, we are assuming that the changes.x,y is not
549 * maintained, if you need the info get it from Tk_GetRootCoords,
550 * and that the toplevel sits at 0,0 when it is drawn.
578 * Here we should handle out of process embedding. At this point,
579 * we are assuming that the changes.x,y is not maintained, if you
580 * need the info get it from Tk_GetRootCoords, and that the
581 * toplevel sits at 0,0 when it is drawn.
551582 */
552583 }
553584 } else {
558589 macParent = macWin->winPtr->parentPtr->privatePtr;
559590 parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width;
560591 }
592
561593 if (macParent) {
562594 deltaX = macParent->xOff + parentBorderwidth +
563595 macWin->winPtr->changes.x - macWin->xOff;
582614 *
583615 * GenerateConfigureNotify --
584616 *
585 * Generates ConfigureNotify events for all the child widgets
586 * of the widget passed in the winPtr parameter. If includeWin
587 * is true, also generates ConfigureNotify event for the
588 * widget itself.
617 * Generates ConfigureNotify events for all the child widgets of the
618 * widget passed in the winPtr parameter. If includeWin is true, also
619 * generates ConfigureNotify event for the widget itself.
589620 *
590621 * Results:
591622 * None.
597628 */
598629
599630 static void
600 GenerateConfigureNotify (TkWindow *winPtr, int includeWin)
631 GenerateConfigureNotify(
632 TkWindow *winPtr,
633 int includeWin)
601634 {
602635 TkWindow *childPtr;
603636
604637 for (childPtr = winPtr->childList; childPtr != NULL;
605 childPtr = childPtr->nextPtr) {
638 childPtr = childPtr->nextPtr) {
606639 if (!Tk_IsMapped(childPtr) || Tk_IsTopLevel(childPtr)) {
607640 continue;
608641 }
631664
632665 void
633666 XRaiseWindow(
634 Display* display, /* Display. */
667 Display *display, /* Display. */
635668 Window window) /* Window. */
636669 {
637670 MacDrawable *macWin = (MacDrawable *) window;
665698
666699 void
667700 XLowerWindow(
668 Display* display, /* Display. */
701 Display *display, /* Display. */
669702 Window window) /* Window. */
670703 {
671704 MacDrawable *macWin = (MacDrawable *) window;
686719 *
687720 * XConfigureWindow --
688721 *
689 * Change the size, position, stacking, or border of the specified
690 * window.
691 *
692 * Results:
693 * None.
694 *
695 * Side effects:
696 * Changes the attributes of the specified window. Note that we
697 * ignore the passed in values and use the values stored in the
698 * TkWindow data structure.
722 * Change the size, position, stacking, or border of the specified window.
723 *
724 * Results:
725 * None.
726 *
727 * Side effects:
728 * Changes the attributes of the specified window. Note that we ignore the
729 * passed in values and use the values stored in the TkWindow data
730 * structure.
699731 *
700732 *----------------------------------------------------------------------
701733 */
702734
703735 void
704736 XConfigureWindow(
705 Display* display, /* Display. */
737 Display *display, /* Display. */
706738 Window w, /* Window. */
707739 unsigned int value_mask,
708 XWindowChanges* values)
740 XWindowChanges *values)
709741 {
710742 MacDrawable *macWin = (MacDrawable *) w;
711743 TkWindow *winPtr = macWin->winPtr;
722754 }
723755
724756 /*
725 * Change the stacking order of the window. Tk actuall keeps all
726 * the information we need for stacking order. All we need to do
727 * is make sure the clipping regions get updated and generate damage
728 * that will ensure things get drawn correctly.
757 * Change the stacking order of the window. Tk actually keeps all the
758 * information we need for stacking order. All we need to do is make sure
759 * the clipping regions get updated and generate damage that will ensure
760 * things get drawn correctly.
729761 */
730762
731763 if (value_mask & CWStackMode) {
748780 *
749781 * TkMacOSXUpdateClipRgn --
750782 *
751 * This function updates the cliping regions for a given window
752 * and all of its children. Once updated the TK_CLIP_INVALID flag
753 * in the subwindow data structure is unset. The TK_CLIP_INVALID
754 * flag should always be unset before any drawing is attempted.
783 * This function updates the cliping regions for a given window and all of
784 * its children. Once updated the TK_CLIP_INVALID flag in the subwindow
785 * data structure is unset. The TK_CLIP_INVALID flag should always be
786 * unset before any drawing is attempted.
755787 *
756788 * Results:
757789 * None.
788820 rgn = TkMacOSXHIShapeCreateMutableWithRect(&bounds);
789821
790822 /*
791 * Clip away the area of any windows that may obscure this
792 * window.
823 * Clip away the area of any windows that may obscure this window.
793824 * For a non-toplevel window, first, clip to the parents visible
794 * clip region.
795 * Second, clip away any siblings that are higher in the
796 * stacking order.
797 * For an embedded toplevel, just clip to the container's visible
798 * clip region. Remember, we only allow one contained window
799 * in a frame, and don't support any other widgets in the frame
800 * either. This is not currently enforced, however.
825 * clip region. Second, clip away any siblings that are higher in
826 * the stacking order. For an embedded toplevel, just clip to the
827 * container's visible clip region. Remember, we only allow one
828 * contained window in a frame, and don't support any other widgets
829 * in the frame either. This is not currently enforced, however.
801830 */
802831
803832 if (!Tk_IsTopLevel(winPtr)) {
804833 TkMacOSXUpdateClipRgn(winPtr->parentPtr);
805834 if (winPtr->parentPtr) {
806835 ChkErr(HIShapeIntersect,
807 winPtr->parentPtr->privatePtr->aboveVisRgn, rgn,
808 rgn);
836 winPtr->parentPtr->privatePtr->aboveVisRgn,
837 rgn, rgn);
809838 }
810839 win2Ptr = winPtr;
811840 while ((win2Ptr = win2Ptr->nextPtr)) {
853882 macWin->aboveVisRgn = HIShapeCreateCopy(rgn);
854883
855884 /*
856 * The final clip region is the aboveVis region (or visible
857 * region) minus all the children of this window.
858 * If the window is a container, we must also subtract the region
859 * of the embedded window.
885 * The final clip region is the aboveVis region (or visible region)
886 * minus all the children of this window. If the window is a
887 * container, we must also subtract the region of the embedded
888 * window.
860889 */
861890
862891 win2Ptr = winPtr->childList;
885914 * TODO: Here we should handle out of process embedding.
886915 */
887916 }
917
888918 if (rgnChanged) {
889919 HIShapeRef diffRgn = HIShapeCreateDifference(
890920 macWin->aboveVisRgn, rgn);
928958 *
929959 * TkMacOSXVisableClipRgn --
930960 *
931 * This function returnd the Macintosh cliping region for the
932 * given window. A NULL Rgn means the window is not visible.
961 * This function returnd the Macintosh cliping region for the given
962 * window. A NULL Rgn means the window is not visible.
933963 *
934964 * Results:
935965 * The region.
961991 *
962992 * TkMacOSXInvalidateWindow --
963993 *
964 * This function makes the window as invalid will generate damage
965 * for the window.
994 * This function makes the window as invalid will generate damage for the
995 * window.
966996 *
967997 * Results:
968998 * None.
10371067 * This function returns the Graphics Port for a given X drawable.
10381068 *
10391069 * Results:
1040 * A CGrafPort . Either an off screen pixmap or a Window.
1070 * A CGrafPort. Either an off screen pixmap or a Window.
10411071 *
10421072 * Side effects:
10431073 * None.
10521082 MacDrawable *macWin = (MacDrawable *) drawable;
10531083 CGrafPtr resultPort = NULL;
10541084
1055 if (macWin) {
1056 if (macWin->toplevel) {
1085 if (!macWin) {
1086 return NULL;
1087 }
1088
1089 /*
1090 * Handle toplevel windows.
1091 */
1092
1093 if (macWin->toplevel) {
1094 TkWindow *contWinPtr;
1095
1096 if (!(macWin->toplevel->flags & TK_EMBEDDED)) {
1097 return macWin->toplevel->grafPtr;
1098 }
1099
1100 /*
1101 * If the Drawable is in an embedded window, use the Port of its
1102 * container.
1103 *
1104 * TRICKY POINT: we can have cases when a toplevel is being destroyed
1105 * where the winPtr for the toplevel has been freed, but the children
1106 * are not all the way destroyed. The children will call this function
1107 * as they are being destroyed, but Tk_IsEmbedded will return garbage.
1108 * So we check the copy of the TK_EMBEDDED flag we put into the
1109 * toplevel's macWin flags.
1110 */
1111
1112 contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
1113
1114 resultPort = NULL;
1115 if (contWinPtr != NULL) {
1116 resultPort = TkMacOSXGetDrawablePort((Drawable)
1117 contWinPtr->privatePtr);
1118 } else if (tkMacOSXEmbedHandler != NULL) {
1119 resultPort = tkMacOSXEmbedHandler->getPortProc((Tk_Window)
1120 macWin->winPtr);
1121 }
1122
1123 if (!resultPort) {
10571124 /*
1058 * If the Drawable is in an embedded window, use the Port of its
1059 * container.
1060 *
1061 * TRICKY POINT: we can have cases when a toplevel is being
1062 * destroyed where the winPtr for the toplevel has been freed, but
1063 * the children are not all the way destroyed. The children will
1064 * call this function as they are being destroyed, but
1065 * Tk_IsEmbedded will return garbage. So we check the copy of the
1066 * TK_EMBEDDED flag we put into the toplevel's macWin flags.
1125 * FIXME: So far as I can tell, the only time that this happens is
1126 * when we are tearing down an embedded child interpreter, and most
1127 * of the time, this is harmless... However, we really need to find
1128 * why the embedding loses.
10671129 */
10681130
1069 if (macWin->toplevel->flags & TK_EMBEDDED) {
1070 TkWindow *contWinPtr;
1071
1072 contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
1073
1074 if (contWinPtr != NULL) {
1075 resultPort = TkMacOSXGetDrawablePort(
1076 (Drawable) contWinPtr->privatePtr);
1077 } else if (tkMacOSXEmbedHandler != NULL) {
1078 resultPort = tkMacOSXEmbedHandler->getPortProc(
1079 (Tk_Window) macWin->winPtr);
1080 }
1081
1082 if (!resultPort) {
1083 /*
1084 * FIXME: So far as I can tell, the only time that this
1085 * happens is when we are tearing down an embedded child
1086 * interpreter, and most of the time, this is harmless...
1087 * However, we really need to find why the embedding loses.
1088 */
1089 TkMacOSXDbgMsg("Couldn't find container");
1090 }
1091
1092 /*
1093 * TODO: Here we should handle out of process embedding.
1094 */
1095 } else {
1096 resultPort = macWin->toplevel->grafPtr;
1097 }
1098 } else {
1099 if ((macWin->flags & TK_IS_PIXMAP) && !macWin->grafPtr) {
1100 Rect bounds = {0, 0, macWin->size.height, macWin->size.width};
1101
1102 ChkErr(NewGWorld, &macWin->grafPtr,
1103 (macWin->flags & TK_IS_BW_PIXMAP) ? 1 : 0,
1104 &bounds, NULL, NULL, 0
1105 #ifdef __LITTLE_ENDIAN__
1106 | kNativeEndianPixMap
1107 #endif
1108 );
1109 }
1110 resultPort = macWin->grafPtr;
1111 }
1112 }
1113
1114 return resultPort;
1131 TkMacOSXDbgMsg("Couldn't find container");
1132 }
1133
1134 /*
1135 * TODO: Here we should handle out of process embedding.
1136 */
1137
1138 return resultPort;
1139 }
1140
1141 if ((macWin->flags & TK_IS_PIXMAP) && !macWin->grafPtr) {
1142 AllocGWorld(macWin->size.width, macWin->size.height,
1143 macWin->flags & TK_IS_BW_PIXMAP, &macWin->grafPtr);
1144 }
1145 return macWin->grafPtr;
11151146 }
11161147
11171148 /*
11371168 /*
11381169 * will probably need to fix this up for embedding
11391170 */
1171
11401172 MacDrawable *macWin = (MacDrawable *) drawable;
1141 ControlRef result = NULL;
1173 TkWindow *contWinPtr;
11421174
11431175 if (macWin == NULL) {
11441176 return NULL;
11451177 }
1178
11461179 if (!(macWin->toplevel->flags & TK_EMBEDDED)) {
11471180 return macWin->toplevel->rootControl;
1148 } else {
1149 TkWindow *contWinPtr;
1150
1151 contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
1152
1153 if (contWinPtr != NULL) {
1154 result = TkMacOSXGetRootControl(
1155 (Drawable) contWinPtr->privatePtr);
1156 } else if (tkMacOSXEmbedHandler != NULL) {
1157 result = NULL;
1158 }
1159 }
1160 return result;
1181 }
1182
1183 contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
1184 if (contWinPtr == NULL) {
1185 return NULL;
1186 }
1187
1188 return TkMacOSXGetRootControl((Drawable) contWinPtr->privatePtr);
11611189 }
11621190
11631191 /*
11651193 *
11661194 * TkMacOSXInvalClipRgns --
11671195 *
1168 * This function invalidates the clipping regions for a given
1169 * window and all of its children. This function should be
1170 * called whenever changes are made to subwindows that would
1171 * affect the size or position of windows.
1172 *
1173 * Results:
1174 * None.
1175 *
1176 * Side effects:
1177 * The cliping regions for the window and its children are
1178 * mark invalid. (Make sure they are valid before drawing.)
1196 * This function invalidates the clipping regions for a given window and
1197 * all of its children. This function should be called whenever changes
1198 * are made to subwindows that would affect the size or position of
1199 * windows.
1200 *
1201 * Results:
1202 * None.
1203 *
1204 * Side effects:
1205 * The cliping regions for the window and its children are mark invalid.
1206 * (Make sure they are valid before drawing.)
11791207 *
11801208 *----------------------------------------------------------------------
11811209 */
11891217 MacDrawable *macWin = winPtr->privatePtr;
11901218
11911219 /*
1192 * If already marked we can stop because all
1193 * decendants will also already be marked.
1220 * If already marked we can stop because all descendants will also already
1221 * be marked.
11941222 */
1223
11951224 if (!macWin || macWin->flags & TK_CLIP_INVALID) {
11961225 return;
11971226 }
12071236 }
12081237
12091238 /*
1210 * Invalidate clip regions for all children &
1211 * their decendants - unless the child is a toplevel.
1239 * Invalidate clip regions for all children & their descendants, unless the
1240 * child is a toplevel.
12121241 */
1242
12131243 childPtr = winPtr->childList;
12141244 while (childPtr) {
12151245 if (!Tk_IsTopLevel(childPtr)) {
12191249 }
12201250
12211251 /*
1222 * Also, if the window is a container, mark its embedded window
1252 * Also, if the window is a container, mark its embedded window.
12231253 */
12241254
12251255 if (Tk_IsContainer(winPtr)) {
12401270 *
12411271 * TkMacOSXWinBounds --
12421272 *
1243 * Given a Tk window this function determines the windows
1244 * bounds in relation to the Macintosh window's coordinate
1245 * system. This is also the same coordinate system as the
1246 * Tk toplevel window in which this window is contained.
1273 * Given a Tk window this function determines the windows bounds in
1274 * relation to the Macintosh window's coordinate system. This is also the
1275 * same coordinate system as the Tk toplevel window in which this window
1276 * is contained.
12471277 *
12481278 * Results:
12491279 * None.
12701300 *
12711301 * TkMacOSXWinCGBounds --
12721302 *
1273 * Given a Tk window this function determines the windows
1274 * bounds in relation to the Macintosh window's coordinate
1275 * system. This is also the same coordinate system as the
1276 * Tk toplevel window in which this window is contained.
1303 * Given a Tk window this function determines the windows bounds in
1304 * relation to the Macintosh window's coordinate system. This is also the
1305 * same coordinate system as the Tk toplevel window in which this window
1306 * is contained.
12771307 *
12781308 * Results:
12791309 * None.
13001330 *
13011331 * UpdateOffsets --
13021332 *
1303 * Updates the X & Y offsets of the given TkWindow from the
1304 * TopLevel it is a decendant of.
1305 *
1306 * Results:
1307 * None.
1308 *
1309 * Side effects:
1310 * The xOff & yOff fields for the Mac window datastructure
1311 * is updated to the proper offset.
1333 * Updates the X & Y offsets of the given TkWindow from the TopLevel it is
1334 * a decendant of.
1335 *
1336 * Results:
1337 * None.
1338 *
1339 * Side effects:
1340 * The xOff & yOff fields for the Mac window datastructure is updated to
1341 * the proper offset.
13121342 *
13131343 *----------------------------------------------------------------------
13141344 */
13231353
13241354 if (winPtr->privatePtr == NULL) {
13251355 /*
1326 * We haven't called Tk_MakeWindowExist for this window yet. The
1327 * offset information will be postponed and calulated at that
1328 * time. (This will usually only happen when a mapped parent is
1329 * being moved but has child windows that have yet to be mapped.)
1356 * We haven't called Tk_MakeWindowExist for this window yet. The offset
1357 * information will be postponed and calulated at that time. (This will
1358 * usually only happen when a mapped parent is being moved but has
1359 * child windows that have yet to be mapped.)
13301360 */
1361
13311362 return;
13321363 }
13331364
13961427 macPix->grafPtr = NULL;
13971428 macPix->context = NULL;
13981429 macPix->size = CGSizeMake(width, height);
1399 {
1400 Rect bounds = {0, 0, height, width};
1401
1402 ChkErr(NewGWorld, &macPix->grafPtr, depth == 1 ? 1 : 0, &bounds, NULL,
1403 NULL, 0
1404 #ifdef __LITTLE_ENDIAN__
1405 | kNativeEndianPixMap
1406 #endif
1407 );
1408 }
1430 AllocGWorld(width, height, depth==1, &macPix->grafPtr);
14091431
14101432 return (Pixmap) macPix;
14111433 }
4747 * permission to use and distribute the software in accordance with the
4848 * terms specified in this license.
4949 *
50 * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.33 2008/10/05 21:26:11 dkf Exp $
50 * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.35 2008/12/10 02:51:16 das Exp $
5151 */
5252
5353 #include "tkMacOSXPrivate.h"
890890 Tcl_AddErrorInfo(interp,
891891 Tk_GetAtomName((Tk_Window) winPtr, protocol));
892892 Tcl_AddErrorInfo(interp, "\" window manager protocol)");
893 Tk_BackgroundError(interp);
893 Tcl_BackgroundException(interp, result);
894894 }
895895 Tcl_Release(interp);
896896 Tcl_Release(protPtr);
1212 * See the file "license.terms" for information on usage and redistribution of
1313 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1414 *
15 * RCS: @(#) $Id: tkMacOSXWm.c,v 1.69 2008/10/08 15:39:13 dgp Exp $
15 * RCS: @(#) $Id: tkMacOSXWm.c,v 1.73 2008/12/07 16:36:26 das Exp $
1616 */
1717
1818 #include "tkMacOSXPrivate.h"
3636 _WMATT_LAST_ATTRIBUTE
3737 } WmAttribute;
3838
39 static const char *WmAttributeNames[] = {
39 static const char *const WmAttributeNames[] = {
4040 "-alpha", "-fullscreen", "-modified", "-notify",
4141 "-titlepath", "-topmost", "-transparent",
4242 NULL
210210 int *maxHeightPtr);
211211 static void RemapWindows(TkWindow *winPtr,
212212 MacDrawable *parentWin);
213
213
214214 /*
215215 *----------------------------------------------------------------------
216216 *
306306
307307 Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
308308 }
309
309
310310 /*
311311 *----------------------------------------------------------------------
312312 *
405405
406406 XMapWindow(winPtr->display, winPtr->window);
407407 }
408
408
409409 /*
410410 *----------------------------------------------------------------------
411411 *
430430 {
431431 XUnmapWindow(winPtr->display, winPtr->window);
432432 }
433
433
434434 /*
435435 *----------------------------------------------------------------------
436436 *
498498 ckfree((char *) wmPtr);
499499 winPtr->wmInfoPtr = NULL;
500500 }
501
501
502502 /*
503503 *----------------------------------------------------------------------
504504 *
524524 {
525525 return;
526526 }
527
527
528528 /*
529529 *----------------------------------------------------------------------
530530 *
551551 Tcl_Obj *const objv[]) /* Argument objects. */
552552 {
553553 Tk_Window tkwin = (Tk_Window) clientData;
554 static const char *optionStrings[] = {
554 static const char *const optionStrings[] = {
555555 "aspect", "attributes", "client", "colormapwindows",
556556 "command", "deiconify", "focusmodel", "forget",
557557 "frame", "geometry", "grid", "group",
685685 /* This should not happen */
686686 return TCL_ERROR;
687687 }
688
688
689689 /*
690690 *----------------------------------------------------------------------
691691 *
754754 WmUpdateGeom(wmPtr, winPtr);
755755 return TCL_OK;
756756 }
757
757
758758 /*
759759 *----------------------------------------------------------------------
760760 *
930930 }
931931 return TCL_OK;
932932 }
933
933
934934 /*
935935 *----------------------------------------------------------------------
936936 *
10051005 }
10061006 return result;
10071007 }
1008
1008
10091009 /*
10101010 *----------------------------------------------------------------------
10111011 *
10771077 }
10781078 return TCL_OK;
10791079 }
1080
1080
10811081 /*
10821082 *----------------------------------------------------------------------
10831083 *
11321132 strcpy(wmPtr->clientMachine, argv3);
11331133 return TCL_OK;
11341134 }
1135
1135
11361136 /*
11371137 *----------------------------------------------------------------------
11381138 *
12201220
12211221 return TCL_OK;
12221222 }
1223
1223
12241224 /*
12251225 *----------------------------------------------------------------------
12261226 *
12571257 }
12581258 if (objc == 3) {
12591259 if (wmPtr->cmdArgv != NULL) {
1260 Tcl_SetResult(interp, Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
1261 TCL_DYNAMIC);
1260 argv3 = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
1261 Tcl_SetResult(interp, argv3, TCL_VOLATILE);
1262 ckfree(argv3);
12621263 }
12631264 return TCL_OK;
12641265 }
12801281 wmPtr->cmdArgv = cmdArgv;
12811282 return TCL_OK;
12821283 }
1283
1284
12841285 /*
12851286 *----------------------------------------------------------------------
12861287 *
13261327 ZoomState : NormalState);
13271328 return TCL_OK;
13281329 }
1329
1330
13301331 /*
13311332 *----------------------------------------------------------------------
13321333 *
13531354 Tcl_Obj *const objv[]) /* Argument objects. */
13541355 {
13551356 register WmInfo *wmPtr = winPtr->wmInfoPtr;
1356 static const char *optionStrings[] = {
1357 static const char *const optionStrings[] = {
13571358 "active", "passive", NULL };
13581359 enum options {
13591360 OPT_ACTIVE, OPT_PASSIVE };
13801381 }
13811382 return TCL_OK;
13821383 }
1383
1384
13841385 /*
13851386 *----------------------------------------------------------------------
13861387 *
14421443 return TCL_OK;
14431444 #endif
14441445 }
1445
1446
14461447 /*
14471448 *----------------------------------------------------------------------
14481449 *
14841485 Tcl_SetResult(interp, buf, TCL_VOLATILE);
14851486 return TCL_OK;
14861487 }
1487
1488
14881489 /*
14891490 *----------------------------------------------------------------------
14901491 *
15471548 }
15481549 return ParseGeometry(interp, argv3, winPtr);
15491550 }
1550
1551
15511552 /*
15521553 *----------------------------------------------------------------------
15531554 *
16371638 WmUpdateGeom(wmPtr, winPtr);
16381639 return TCL_OK;
16391640 }
1640
1641
16411642 /*
16421643 *----------------------------------------------------------------------
16431644 *
17001701 }
17011702 return TCL_OK;
17021703 }
1703
1704
17041705 /*
17051706 *----------------------------------------------------------------------
17061707 *
17681769 }
17691770 return TCL_OK;
17701771 }
1771
1772
17721773 /*
17731774 *----------------------------------------------------------------------
17741775 *
18221823 TkpWmSetState(winPtr, IconicState);
18231824 return TCL_OK;
18241825 }
1825
1826
18261827 /*
18271828 *----------------------------------------------------------------------
18281829 *
18791880 }
18801881 return TCL_OK;
18811882 }
1882
1883
18831884 /*
18841885 *----------------------------------------------------------------------
18851886 *
19311932 }
19321933 return TCL_OK;
19331934 }
1934
1935
19351936 /*
19361937 *----------------------------------------------------------------------
19371938 *
19971998
19981999 return TCL_OK;
19992000 }
2000
2001
20012002 /*
20022003 *----------------------------------------------------------------------
20032004 *
20532054 }
20542055 return TCL_OK;
20552056 }
2056
2057
20572058 /*
20582059 *----------------------------------------------------------------------
20592060 *
21362137 }
21372138 return TCL_OK;
21382139 }
2139
2140
21402141 /*
21412142 *----------------------------------------------------------------------
21422143 *
21732174 if (!Tk_IsTopLevel(frameWin)) {
21742175 MacDrawable *macWin = (MacDrawable *) winPtr->window;
21752176
2177 if (!Tk_IsManageable(frameWin)) {
2178 Tcl_AppendResult(interp, "window \"",
2179 Tk_PathName(frameWin), "\" is not manageable: must be "
2180 "a frame, labelframe or toplevel", NULL);
2181 return TCL_ERROR;
2182 }
21762183 TkFocusSplit(winPtr);
21772184 Tk_UnmapWindow(frameWin);
21782185 if (wmPtr == NULL) {
21982205 return TCL_OK;
21992206 #endif
22002207 }
2201
2208
22022209 /*
22032210 *----------------------------------------------------------------------
22042211 *
22492256 WmUpdateGeom(wmPtr, winPtr);
22502257 return TCL_OK;
22512258 }
2252
2259
22532260 /*
22542261 *----------------------------------------------------------------------
22552262 *
23002307 WmUpdateGeom(wmPtr, winPtr);
23012308 return TCL_OK;
23022309 }
2303
2310
23042311 /*
23052312 *----------------------------------------------------------------------
23062313 *
23462353 ApplyMasterOverrideChanges(winPtr, NULL);
23472354 return TCL_OK;
23482355 }
2349
2356
23502357 /*
23512358 *----------------------------------------------------------------------
23522359 *
23732380 Tcl_Obj *const objv[]) /* Argument objects. */
23742381 {
23752382 register WmInfo *wmPtr = winPtr->wmInfoPtr;
2376 static const char *optionStrings[] = {
2383 static const char *const optionStrings[] = {
23772384 "program", "user", NULL };
23782385 enum options {
23792386 OPT_PROGRAM, OPT_USER };
24102417 WmUpdateGeom(wmPtr, winPtr);
24112418 return TCL_OK;
24122419 }
2413
2420
24142421 /*
24152422 *----------------------------------------------------------------------
24162423 *
25022509 }
25032510 return TCL_OK;
25042511 }
2505
2512
25062513 /*
25072514 *----------------------------------------------------------------------
25082515 *
25782585 oldAttributes, 1);
25792586 return TCL_OK;
25802587 }
2581
2588
25822589 /*
25832590 *----------------------------------------------------------------------
25842591 *
26052612 Tcl_Obj *const objv[]) /* Argument objects. */
26062613 {
26072614 register WmInfo *wmPtr = winPtr->wmInfoPtr;
2608 static const char *optionStrings[] = {
2615 static const char *const optionStrings[] = {
26092616 "program", "user", NULL };
26102617 enum options {
26112618 OPT_PROGRAM, OPT_USER };
26432650 WmUpdateGeom(wmPtr, winPtr);
26442651 return TCL_OK;
26452652 }
2646
2653
26472654 /*
26482655 *----------------------------------------------------------------------
26492656 *
26702677 Tcl_Obj *const objv[]) /* Argument objects. */
26712678 {
26722679 TkWindow **windows, **window_ptr;
2673 static const char *optionStrings[] = {
2680 static const char *const optionStrings[] = {
26742681 "isabove", "isbelow", NULL };
26752682 enum options {
26762683 OPT_ISABOVE, OPT_ISBELOW };
27612768 }
27622769 return TCL_OK;
27632770 }
2764
2771
27652772 /*
27662773 *----------------------------------------------------------------------
27672774 *
27882795 Tcl_Obj *const objv[]) /* Argument objects. */
27892796 {
27902797 register WmInfo *wmPtr = winPtr->wmInfoPtr;
2791 static const char *optionStrings[] = {
2798 static const char *const optionStrings[] = {
27922799 "normal", "iconic", "withdrawn", "zoomed", NULL };
27932800 enum options {
27942801 OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED };
28652872 }
28662873 return TCL_OK;
28672874 }
2868
2875
28692876 /*
28702877 *----------------------------------------------------------------------
28712878 *
29112918 }
29122919 return TCL_OK;
29132920 }
2914
2921
29152922 /*
29162923 *----------------------------------------------------------------------
29172924 *
29963003 ApplyMasterOverrideChanges(winPtr, NULL);
29973004 return TCL_OK;
29983005 }
2999
3006
30003007 /*
30013008 *----------------------------------------------------------------------
30023009 *
30523059 wmPtr->flags |= WM_UPDATE_PENDING;
30533060 }
30543061 }
3055
3062
30563063 /*
30573064 *----------------------------------------------------------------------
30583065 *
31583165 wmPtr->flags |= WM_UPDATE_PENDING;
31593166 }
31603167 }
3161
3168
31623169 /*
31633170 *----------------------------------------------------------------------
31643171 *
32153222 wmPtr->flags |= WM_UPDATE_PENDING;
32163223 }
32173224 }
3218
3225
32193226 /*
32203227 *----------------------------------------------------------------------
32213228 *
32653272 Tcl_Panic("recieved unwanted reparent event");
32663273 }
32673274 }
3268
3275
32693276 /*
32703277 *----------------------------------------------------------------------
32713278 *
33003307 wmPtr->flags |= WM_UPDATE_PENDING;
33013308 }
33023309 }
3303
3310
33043311 /*
33053312 *----------------------------------------------------------------------
33063313 *
33293336 TkWindow *winPtr = clientData;
33303337 WmInfo *wmPtr = winPtr->wmInfoPtr;
33313338 int x, y, width, height, min, max;
3332 unsigned long serial;
33333339
33343340 wmPtr->flags &= ~WM_UPDATE_PENDING;
33353341
34943500 }
34953501 return;
34963502 }
3497 serial = NextRequest(winPtr->display);
34983503 if (wmPtr->flags & WM_MOVE_PENDING) {
34993504 wmPtr->configWidth = width;
35003505 wmPtr->configHeight = height;
35193524 wmPtr->flags &= ~WM_SYNC_PENDING;
35203525 }
35213526 }
3522
3527
35233528 /*
35243529 *----------------------------------------------------------------------
35253530 *
35453550
35463551 wmPtr->flags &= ~WM_UPDATE_SIZE_HINTS;
35473552 }
3548
3553
35493554 /*
35503555 *----------------------------------------------------------------------
35513556 *
36863691 Tcl_AppendResult(interp, "bad geometry specifier \"", string, "\"", NULL);
36873692 return TCL_ERROR;
36883693 }
3689
3694
36903695 /*
36913696 *----------------------------------------------------------------------
36923697 *
37823787 *xPtr = x;
37833788 *yPtr = y;
37843789 }
3785
3790
37863791 /*
37873792 *----------------------------------------------------------------------
37883793 *
39023907 }
39033908 return (Tk_Window) winPtr;
39043909 }
3905
3910
39063911 /*
39073912 *----------------------------------------------------------------------
39083913 *
39954000 *newY = y;
39964001 return (Tk_Window) winPtr;
39974002 }
3998
4003
39994004 /*
40004005 *----------------------------------------------------------------------
40014006 *
40624067 goto noVRoot;
40634068 }
40644069 }
4065
4070
40664071 /*
40674072 *----------------------------------------------------------------------
40684073 *
41194124 *widthPtr = wmPtr->vRootWidth;
41204125 *heightPtr = wmPtr->vRootHeight;
41214126 }
4122
4127
41234128 /*
41244129 *----------------------------------------------------------------------
41254130 *
41734178 UpdateGeometryInfo(winPtr);
41744179 }
41754180 }
4176
4181
41774182 /*
41784183 *----------------------------------------------------------------------
41794184 *
42874292 SendBehind(macWindow, otherMacWindow);
42884293 }
42894294 }
4290
4295
42914296 /*
42924297 *----------------------------------------------------------------------
42934298 *
43784383 * we don't support colormaps. If we did they would be installed here.
43794384 */
43804385 }
4381
4386
43824387 /*
43834388 *----------------------------------------------------------------------
43844389 *
44474452 }
44484453 }
44494454 }
4450
4455
44514456 /*
44524457 *----------------------------------------------------------------------
44534458 *
44754480 {
44764481 XQueryPointer(NULL, None, NULL, NULL, xPtr, yPtr, NULL, NULL, NULL);
44774482 }
4478
4483
44794484 /*
44804485 *----------------------------------------------------------------------
44814486 *
45344539 geometry->right = wmPtr->x + winPtr->changes.width;
45354540 geometry->bottom = wmPtr->y + winPtr->changes.height;
45364541 }
4537
4542
45384543 /*
45394544 *----------------------------------------------------------------------
45404545 *
45744579 return true;
45754580 }
45764581 }
4577
4582
45784583 /*
45794584 *----------------------------------------------------------------------
45804585 *
46964701 }
46974702 return false;
46984703 }
4699
4704
47004705 /*
47014706 *----------------------------------------------------------------------
47024707 *
47344739 CFRelease(title);
47354740 }
47364741 }
4737
4742
47384743 /*
47394744 *----------------------------------------------------------------------
47404745 *
47614766 }
47624767 return None;
47634768 }
4764
4769
47654770 /*
47664771 *----------------------------------------------------------------------
47674772 *
47934798 }
47944799 return (Window) Tcl_GetHashValue(hPtr);
47954800 }
4796
4801
47974802 /*
47984803 *----------------------------------------------------------------------
47994804 *
48524857 return IsWindowInStandardState(TkMacOSXDrawableWindow(winPtr->window),
48534858 &idealSize, NULL);
48544859 }
4855
4860
48564861 /*
48574862 *----------------------------------------------------------------------
48584863 *
49364941 (zoomPart == inZoomIn ? NormalState : ZoomState);
49374942 return true;
49384943 }
4939
4944
49404945 /*
49414946 *----------------------------------------------------------------------
49424947 *
49634968 int objc, /* Number of arguments. */
49644969 Tcl_Obj *const objv[]) /* Argument objects. */
49654970 {
4966 static const char *subcmds[] = {
4971 static const char *const subcmds[] = {
49674972 "style", NULL
49684973 };
49694974 enum SubCmds {
50045009 /* won't be reached */
50055010 return TCL_ERROR;
50065011 }
5007
5012
50085013 /*
50095014 *----------------------------------------------------------------------
50105015 *
52065211 }
52075212 return TCL_OK;
52085213 }
5209
5214
52105215 /*
52115216 *----------------------------------------------------------------------
52125217 *
52445249 winPtr->wmInfoPtr->flags |= WM_HEIGHT_NOT_RESIZABLE;
52455250 }
52465251 }
5247
5252
52485253 /*
52495254 *----------------------------------------------------------------------
52505255 *
53955400 }
53965401 #endif /* TK_MAC_DEBUG_WINDOWS */
53975402 }
5398
5403
53995404 /*
54005405 *----------------------------------------------------------------------
54015406 *
54315436 }
54325437 Tcl_SetHashValue(valueHashPtr, window);
54335438 }
5434
5439
54355440 /*
54365441 *----------------------------------------------------------------------
54375442 *
54655470 Tcl_DeleteHashEntry(entryPtr);
54665471 }
54675472 }
5468
5473
54695474 /*
54705475 *----------------------------------------------------------------------
54715476 *
54975502 winPtr->privatePtr->toplevel->winPtr->wmInfoPtr->scrollWinPtr = NULL;
54985503 }
54995504 }
5500
5505
55015506 /*
55025507 *----------------------------------------------------------------------
55035508 *
55305535 }
55315536 return winPtr;
55325537 }
5533
5538
55345539 /*
55355540 *----------------------------------------------------------------------
55365541 *
55605565 }
55615566 return winPtr;
55625567 }
5563
5568
55645569 /*
55655570 *----------------------------------------------------------------------
55665571 *
56205625 TkMacOSXZoomToplevel(macWin, inZoomOut);
56215626 }
56225627 }
5623
5628
56245629 /*
56255630 *----------------------------------------------------------------------
56265631 *
56505655 GetWindowClass(wRef, &class);
56515656 return (class == kFloatingWindowClass);
56525657 }
5653
5658
56545659 /*
56555660 *----------------------------------------------------------------------
56565661 *
56735678 {
56745679 return winPtr->wmInfoPtr->macClass;
56755680 }
5676
5681
56775682 /*
56785683 *--------------------------------------------------------------
56795684 *
57085713 *xOffset = winPtr->wmInfoPtr->xInParent;
57095714 *yOffset = winPtr->wmInfoPtr->yInParent;
57105715 }
5711
5716
57125717 /*
57135718 *----------------------------------------------------------------------
57145719 *
57345739 Tcl_GetTime(&now);
57355740 return (long) now.sec * 1000 + now.usec / 1000;
57365741 }
5737
5742
57385743 /*
57395744 *----------------------------------------------------------------------
57405745 *
57625767 * Don't need to do a thing. Tk manages the focus for us.
57635768 */
57645769 }
5765
5770
57665771 /*
57675772 *----------------------------------------------------------------------
57685773 *
58085813
58095814 return NextRequest(winPtr->display);
58105815 }
5811
5816
58125817 /*
58135818 *----------------------------------------------------------------------
58145819 *
58555860 WmStackorderToplevelWrapperMap(childPtr, display, table);
58565861 }
58575862 }
5858
5863
58595864 /*
58605865 *----------------------------------------------------------------------
58615866 *
59345939 Tcl_DeleteHashTable(&table);
59355940 return windows;
59365941 }
5937
5942
59385943 /*
59395944 *----------------------------------------------------------------------
59405945 *
60256030 + strWidths.bottom;
60266031 }
60276032 }
6028
6033
60296034 /*
60306035 *----------------------------------------------------------------------
60316036 *
60916096 }
60926097 }
60936098 }
6094
6099
60956100 /*
60966101 *----------------------------------------------------------------------
60976102 *
61456150 }
61466151 return group;
61476152 }
6148
6153
61496154 /*
61506155 *----------------------------------------------------------------------
61516156 *
62306235 TkMacOSXEnterExitFullscreen(winPtr, IsWindowActive(window));
62316236 return result;
62326237 }
6233
6238
62346239 /*
62356240 *----------------------------------------------------------------------
62366241 *
62786283 }
62796284 }
62806285 }
6281
6286
62826287 /*
62836288 *----------------------------------------------------------------------
62846289 *
63756380 *minWidthPtr = minWidth;
63766381 *minHeightPtr = minHeight;
63776382 }
6378
6383
63796384 /*
63806385 *----------------------------------------------------------------------
63816386 *
64316436 *maxHeightPtr = maxHeight;
64326437 }
64336438 }
6434
6439
64356440 /*
64366441 *----------------------------------------------------------------------
64376442 *
64776482 RemapWindows(childPtr, (MacDrawable *) winPtr->window);
64786483 }
64796484 }
6480
6485
64816486 /*
64826487 * Local Variables:
64836488 * fill-column: 78
1212 * See the file "license.terms" for information on usage and redistribution of
1313 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1414 *
15 * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.29 2008/08/19 15:52:13 georgeps Exp $
15 * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.31 2008/12/20 01:33:09 das Exp $
1616 */
1717
1818 #include "tkMacOSXPrivate.h"
170170 Gestalt(gestaltQuickdrawVersion, (long *) &display->proto_minor_version);
171171 display->proto_major_version = 10;
172172 display->proto_minor_version -= gestaltMacOSXQD;
173 display->vendor = "Apple";
173 display->vendor = (char*) "Apple";
174174 Gestalt(gestaltSystemVersion, (long *) &display->release);
175175
176176 /*
625625 }
626626
627627 void
628 XRefreshKeyboardMapping( XMappingEvent* x)
628 XRefreshKeyboardMapping(
629 XMappingEvent *x)
629630 {
630631 /* used by tkXEvent.c */
631632 Debugger();
10761077
10771078 void
10781079 XChangeWindowAttributes(
1079 Display* display,
1080 Display *display,
10801081 Window w,
10811082 unsigned long value_mask,
1082 XSetWindowAttributes* attributes)
1083 XSetWindowAttributes *attributes)
10831084 {
10841085 }
10851086
10861087 void
10871088 XSetWindowBackground(
1088 Display *display,
1089 Window window,
1090 unsigned long value)
1089 Display *display,
1090 Window window,
1091 unsigned long value)
10911092 {
10921093 }
10931094
10941095 void
10951096 XSetWindowBackgroundPixmap(
1096 Display* display,
1097 Display *display,
10971098 Window w,
10981099 Pixmap background_pixmap)
10991100 {
11011102
11021103 void
11031104 XSetWindowBorder(
1104 Display* display,
1105 Display *display,
11051106 Window w,
11061107 unsigned long border_pixel)
11071108 {
11091110
11101111 void
11111112 XSetWindowBorderPixmap(
1112 Display* display,
1113 Display *display,
11131114 Window w,
11141115 Pixmap border_pixmap)
11151116 {
11171118
11181119 void
11191120 XSetWindowBorderWidth(
1120 Display* display,
1121 Display *display,
11211122 Window w,
11221123 unsigned int width)
11231124 {
11251126
11261127 void
11271128 XSetWindowColormap(
1128 Display* display,
1129 Display *display,
11291130 Window w,
11301131 Colormap colormap)
11311132 {
11341135
11351136 Status
11361137 XStringListToTextProperty(
1137 char** list,
1138 char **list,
11381139 int count,
1139 XTextProperty* text_prop_return)
1140 XTextProperty *text_prop_return)
11401141 {
11411142 Debugger();
11421143 return (Status) 0;
11431144 }
1145
11441146 void
11451147 XSetWMClientMachine(
1146 Display* display,
1148 Display *display,
11471149 Window w,
1148 XTextProperty* text_prop)
1150 XTextProperty *text_prop)
11491151 {
11501152 Debugger();
11511153 }
1154
11521155 XIC
1153 XCreateIC(
1154 void)
1156 XCreateIC(void)
11551157 {
11561158 Debugger();
11571159 return (XIC) 0;
2626 * top-level window, not to the Tk_Window. BoxToRect()
2727 * accounts for this.
2828 *
29 * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.22 2008/05/04 17:17:33 jenglish Exp $
29 * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.26 2008/12/08 00:10:36 das Exp $
3030 */
3131
3232 #include "tkMacOSXPrivate.h"
472472 };
473473
474474 /*----------------------------------------------------------------------
475 * +++ Spinbuttons.
476 *
477 * From Apple HIG, part III, section "Controls", "The Stepper Control":
478 * there should be 2 pixels of space between the stepper control
479 * (AKA IncDecButton, AKA "little arrows") and the text field it modifies.
480 */
481
482 static Ttk_Padding SpinbuttonMargins = {2,0,2,0};
483 static void SpinButtonElementSize(
484 void *clientData, void *elementRecord, Tk_Window tkwin,
485 int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
486 {
487 SInt32 s;
488
489 ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s);
490 *widthPtr = s + Ttk_PaddingWidth(SpinbuttonMargins);
491 ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s);
492 *heightPtr = s + Ttk_PaddingHeight(SpinbuttonMargins);
493 }
494
495 static void SpinButtonElementDraw(
496 void *clientData, void *elementRecord, Tk_Window tkwin,
497 Drawable d, Ttk_Box b, Ttk_State state)
498 {
499 Rect bounds = BoxToRect(d, Ttk_PadBox(b, SpinbuttonMargins));
500 ThemeButtonDrawInfo info;
501
502 /* @@@ can't currently distinguish PressedUp (== Pressed) from PressedDown;
503 * ignore this bit for now [see #2219588]
504 */
505 info.state = Ttk_StateTableLookup(ThemeStateTable,
506 state & ~TTK_STATE_PRESSED);
507 info.value = Ttk_StateTableLookup(ButtonValueTable, state);
508 info.adornment = kThemeAdornmentNone;
509
510 BEGIN_DRAWING(d)
511 ChkErr(DrawThemeButton,
512 &bounds, kThemeIncDecButton, &info, NULL, NULL, NULL, 0);
513 END_DRAWING
514 }
515
516 static Ttk_ElementSpec SpinButtonElementSpec = {
517 TK_STYLE_VERSION_2,
518 sizeof(NullElement),
519 TtkNullElementOptions,
520 SpinButtonElementSize,
521 SpinButtonElementDraw
522 };
523
524
525 /*----------------------------------------------------------------------
475526 * +++ DrawThemeTrack-based elements --
476527 * Progress bars and scales. (See also: <<NOTE-TRACKS>>)
477528 */
699750 Drawable d, Ttk_Box b, unsigned int state)
700751 {
701752 Rect bounds = BoxToRect(d, b);
702 ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
753 ThemeDrawState drawState;
703754
704755 /*
705756 * DrawThemeSeparator only supports kThemeStateActive / kThemeStateInactive
706757 */
707758 state &= TTK_STATE_BACKGROUND;
759 drawState = Ttk_StateTableLookup(ThemeStateTable, state);
708760 BEGIN_DRAWING(d)
709761 ChkErr(DrawThemeSeparator, &bounds, drawState);
710762 END_DRAWING
901953 int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
902954 {
903955 SInt32 s;
904 GetThemeMetric(kThemeMetricDisclosureTriangleWidth, &s); *widthPtr = s;
905 GetThemeMetric(kThemeMetricDisclosureTriangleHeight, &s); *heightPtr = s;
956
957 ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s);
958 *widthPtr = s;
959 ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s);
960 *heightPtr = s;
906961 }
907962
908963 static void DisclosureElementDraw(
9751030 TTK_NODE("Notebook.label", TTK_EXPAND|TTK_FILL_BOTH))))
9761031
9771032 /* Progress bars -- track only */
1033 TTK_LAYOUT("TSpinbox",
1034 TTK_NODE("Spinbox.spinbutton", TTK_PACK_RIGHT|TTK_STICK_E)
1035 TTK_GROUP("Spinbox.field", TTK_EXPAND|TTK_FILL_X,
1036 TTK_NODE("Spinbox.textarea", TTK_EXPAND|TTK_FILL_X)))
1037
9781038 TTK_LAYOUT("TProgressbar",
9791039 TTK_NODE("Progressbar.track", TTK_EXPAND|TTK_FILL_BOTH))
9801040
9841044 TTK_NODE("Treeheading.image", TTK_PACK_RIGHT)
9851045 TTK_NODE("Treeheading.text", 0))
9861046
987 /* Tree items -- omit focus ring */
1047 /* Tree items -- omit focus ring */
9881048 TTK_LAYOUT("Item",
9891049 TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH,
9901050 TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT)
10231083 &ButtonElementSpec, &BevelButtonParms);
10241084 Ttk_RegisterElementSpec(themePtr, "Menubutton.button",
10251085 &ButtonElementSpec, &PopupButtonParms);
1086 Ttk_RegisterElementSpec(themePtr, "Spinbox.spinbutton",
1087 &SpinButtonElementSpec, 0);
10261088 Ttk_RegisterElementSpec(themePtr, "Combobox.button",
10271089 &ComboboxElementSpec, 0);
10281090 Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator",
10351097
10361098 Ttk_RegisterElementSpec(themePtr, "Labelframe.border",&GroupElementSpec,0);
10371099 Ttk_RegisterElementSpec(themePtr, "Entry.field",&EntryElementSpec,0);
1100 Ttk_RegisterElementSpec(themePtr, "Spinbox.field",&EntryElementSpec,0);
10381101
10391102 Ttk_RegisterElementSpec(themePtr, "separator",&SeparatorElementSpec,0);
10401103 Ttk_RegisterElementSpec(themePtr, "hseparator",&SeparatorElementSpec,0);
66 # Copyright (c) 1998-1999 by Scriptics Corporation.
77 # All rights reserved.
88 #
9 # RCS: @(#) $Id: bind.test,v 1.22 2008/07/25 23:47:15 aniap Exp $
9 # RCS: @(#) $Id: bind.test,v 1.26 2008/11/23 21:58:24 patthoyts Exp $
1010
1111 package require tcltest 2.2
1212 namespace import ::tcltest::*
194194 bind .t <Enter> {lappend x "%W enter .t"}
195195 bind .t.f <Enter> {lappend x "%W enter .t.f"}
196196
197 event gen .t.f <Enter>
197 event generate .t.f <Enter>
198198 return $x
199199 } -cleanup {
200200 destroy .t.f
215215 bind .t.f <Enter> {lappend x "%W enter .t.f"}
216216
217217 bindtags .t.f {.t.f {a b} xyz}
218 event gen .t.f <Enter>
218 event generate .t.f <Enter>
219219 return $x
220220 } -cleanup {
221221 destroy .t.f
230230 bind {a b} <Enter> {lappend x "%W enter {a b}"}
231231 bind .t <Enter> {lappend x "%W enter .t"}
232232
233 event gen .t <Enter>
233 event generate .t <Enter>
234234 return $x
235235 } -cleanup {
236236 unsetBindings
253253 bindtags .t.f {.t.f .t.f2 .t.f3}
254254 bind .t.f <Enter> {lappend x "%W enter .t.f"}
255255 bind .t.f3 <Enter> {lappend x "%W enter .t.f3"}
256 event gen .t.f <Enter>
256 event generate .t.f <Enter>
257257 return $x
258258 } -cleanup {
259259 destroy .t.f .t.f3
274274 bind .t <Enter> {lappend x "%W enter .t"}
275275 bindtags .t.f {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}
276276
277 event gen .t.f <Enter>
277 event generate .t.f <Enter>
278278 } -cleanup {
279279 destroy .t.f
280280 unsetBindings
317317 bind b <1> "lappend x b1"
318318 testcbind c <1> "lappend x c1" "lappend x bye.c1"
319319 testcbind c <2> "lappend x all2" "lappend x bye.all2"
320 event gen .g <1>
320 event generate .g <1>
321321 }
322322 set x [foo eval set x]
323323 return $x
376376 set x {}
377377 } -body {
378378 testcbind .t.f <1> "lappend x 1" "lappend x bye.1"
379 event gen .t.f <1>
379 event generate .t.f <1>
380380 destroy .t.f
381381 return $x
382382 } -result {bye.1}
403403 } -body {
404404 testcbind .t.f <1> "lappend x .t.f; testcbind Frame <1> {lappend x Frame}"
405405 testcbind Frame <1> "lappend x never"
406 event gen .t.f <1>
406 event generate .t.f <1>
407407 bind .t.f <1> {}
408408 return $x
409409 } -cleanup {
460460 bind b <1> {lappend x b1}
461461 testcbind c <1> {lappend x c1} {lappend x bye.c1}
462462 testcbind c <2> {lappend x c2} {lappend x bye.c2}
463 event gen .t.f <1>
463 event generate .t.f <1>
464464 bind a <1> {}
465465 bind b <1> {}
466466 return $x
542542 update
543543 set x {}
544544 } -body {
545 testcbind .t.f <1> {lappend x before; event gen .t.f <2>; lappend x after} {lappend x bye.f1}
545 testcbind .t.f <1> {lappend x before; event generate .t.f <2>; lappend x after} {lappend x bye.f1}
546546 testcbind .t.f <2> {destroy .t.f} {lappend x bye.f2}
547547 bind .t.f <Destroy> {lappend x fDestroy}
548548 testcbind .t.f <3> {foo} {lappend x bye.f3}
549 event gen .t.f <1>
549 event generate .t.f <1>
550550 return $x
551551 } -cleanup {
552552 destroy .t.f
559559 update
560560 set x {}
561561 } -body {
562 bind Test <KeyPress> {lappend x "%W %K Test press any"}
563 bind all <KeyPress> {lappend x "%W %K all press any"}
564 bind Test a {lappend x "%W %K Test press a"}
565 bind all x {lappend x "%W %K all press x"}
566 bind .t.f a {lappend x "%W %K .t.f press a"}
562 bind Test <KeyPress> {lappend x "%W %K Test KeyPress"}
563 bind all <KeyPress> {lappend x "%W %K all KeyPress"}
564 bind Test : {lappend x "%W %K Test :"}
565 bind all _ {lappend x "%W %K all _"}
566 bind .t.f : {lappend x "%W %K .t.f :"}
567567
568 event gen .t.f <Key-a>
569 event gen .t.f <Key-b>
570 event gen .t.f <Key-x>
568 event generate .t.f <Key-:>
569 event generate .t.f <Key-+>
570 event generate .t.f <Key-_>
571571 return $x
572572 } -cleanup {
573573 destroy .t.f
574574 bind all <KeyPress> {}
575575 bind Test <KeyPress> {}
576 bind all x {}
577 bind Test a {}
578 } -result {{.t.f a .t.f press a} {.t.f a Test press a} {.t.f a all press any} {.t.f b Test press any} {.t.f b all press any} {.t.f x Test press any} {.t.f x all press x}}
576 bind all _ {}
577 bind Test : {}
578 } -result {{.t.f colon .t.f :} {.t.f colon Test :} {.t.f colon all KeyPress} {.t.f plus Test KeyPress} {.t.f plus all KeyPress} {.t.f underscore Test KeyPress} {.t.f underscore all _}}
579579
580580 test bind-13.2 {Tk_BindEvent procedure} -setup {
581581 frame .t.f -class Test -width 150 -height 100
586586 } -body {
587587 bind Test <KeyPress> {lappend x "%W %K Test press any"; break}
588588 bind all <KeyPress> {continue; lappend x "%W %K all press any"}
589 bind .t.f b {lappend x "%W %K .t.f press a"}
589 bind .t.f : {lappend x "%W %K .t.f pressed colon"}
590590
591 event gen .t.f <Key-b>
591 event generate .t.f <Key-colon>
592592 return $x
593593 } -cleanup {
594594 destroy .t.f
595595 bind all <KeyPress> {}
596596 bind Test <KeyPress> {}
597 } -result {{.t.f b .t.f press a} {.t.f b Test press any}}
597 } -result {{.t.f colon .t.f pressed colon} {.t.f colon Test press any}}
598598
599599 test bind-13.3 {Tk_BindEvent procedure} -setup {
600600 proc bgerror args {}
605605 set x {}
606606 } -body {
607607 bind Test <KeyPress> {lappend x "%W %K Test press any"; error Test}
608 bind .t.f b {lappend x "%W %K .t.f press a"}
609 event gen .t.f <Key-b>
608 bind .t.f : {lappend x "%W %K .t.f pressed colon"}
609 event generate .t.f <Key-colon>
610610 update
611611 list $x $errorInfo
612612 } -cleanup {
613613 destroy .t.f
614614 bind Test <KeyPress> {}
615615 rename bgerror {}
616 } -result {{{.t.f b .t.f press a} {.t.f b Test press any}} {Test
616 } -result {{{.t.f colon .t.f pressed colon} {.t.f colon Test press any}} {Test
617617 while executing
618618 "error Test"
619619 (command bound to event)}}
620620 test bind-13.4 {Tk_BindEvent procedure} -setup {
621621 proc foo {} {
622622 set x 44
623 event gen .t.f <Key-a>
623 event generate .t.f <Key-:>
624624 }
625625 frame .t.f -class Test -width 150 -height 100
626626 pack .t.f
628628 update
629629 set x {}
630630 } -body {
631 bind Test a {lappend x "%W %K Test press a"}
632 bind .t.f a {lappend x "%W %K .t.f press a"}
631 bind Test : {lappend x "%W %K Test"}
632 bind .t.f : {lappend x "%W %K .t.f"}
633633 foo
634634 return $x
635635 } -cleanup {
636636 destroy .t.f
637 bind Test a {}
638 } -result {{.t.f a .t.f press a} {.t.f a Test press a}}
637 bind Test : {}
638 } -result {{.t.f colon .t.f} {.t.f colon Test}}
639639
640640 test bind-13.5 {Tk_BindEvent procedure} -body {
641641 bind all <Destroy> {lappend x "%W destroyed"}
660660 update
661661 set x {}
662662 } -body {
663 bind .t.f z {lappend x "%W z (.t.f binding)"}
664 bind Test z {lappend x "%W z (.t.f binding)"}
665 bind all z {bind .t.f z {}; lappend x "%W z (.t.f binding)"}
666 event gen .t.f <Key-z>
667 return $x
668 } -cleanup {
669 bind Test z {}
670 bind all z {}
671 destroy .t.f
672 } -result {{.t.f z (.t.f binding)} {.t.f z (.t.f binding)} {.t.f z (.t.f binding)}}
663 bind .t.f : {lappend x "%W (.t.f binding)"}
664 bind Test : {lappend x "%W (Test binding)"}
665 bind all : {bind .t.f : {}; lappend x "%W (all binding)"}
666 event generate .t.f <Key-:>
667 return $x
668 } -cleanup {
669 bind Test : {}
670 bind all : {}
671 destroy .t.f
672 } -result {{.t.f (.t.f binding)} {.t.f (Test binding)} {.t.f (all binding)}}
673673 test bind-13.8 {Tk_BindEvent procedure} -setup {
674674 frame .t.f -class Test -width 150 -height 100
675675 pack .t.f
677677 update
678678 set x {}
679679 } -body {
680 bind .t.f z {lappend x "%W z (.t.f binding)"}
681 bind Test z {lappend x "%W z (.t.f binding)"}
682 bind all z {destroy .t.f; lappend x "%W z (.t.f binding)"}
683 event gen .t.f <Key-z>
684 return $x
685 } -cleanup {
686 bind Test z {}
687 bind all z {}
688 destroy .t.f
689 } -result {{.t.f z (.t.f binding)} {.t.f z (.t.f binding)} {.t.f z (.t.f binding)}}
680 bind .t.f : {lappend x "%W (.t.f binding)"}
681 bind Test : {lappend x "%W (Test binding)"}
682 bind all : {destroy .t.f; lappend x "%W (all binding)"}
683 event generate .t.f <Key-:>
684 return $x
685 } -cleanup {
686 bind Test : {}
687 bind all : {}
688 destroy .t.f
689 } -result {{.t.f (.t.f binding)} {.t.f (Test binding)} {.t.f (all binding)}}
690690
691691 test bind-13.9 {Tk_BindEvent procedure} -setup {
692692 frame .t.f -class Test -width 150 -height 100
697697 } -body {
698698 bind .t.f <1> {lappend x "%W z (.t.f <1> binding)"}
699699 bind .t.f <ButtonPress> {lappend x "%W z (.t.f <ButtonPress> binding)"}
700 event gen .t.f <Button-1>
701 event gen .t.f <Button-2>
700 event generate .t.f <Button-1>
701 event generate .t.f <Button-2>
702702 return $x
703703 } -cleanup {
704704 destroy .t.f
712712 } -body {
713713 bind .t.f <Enter> "lappend x Enter%#"
714714 bind .t.f <Leave> "lappend x Leave%#"
715 event gen .t.f <Enter> -serial 100 -detail NotifyAncestor
716 event gen .t.f <Enter> -serial 101 -detail NotifyInferior
717 event gen .t.f <Leave> -serial 102 -detail NotifyAncestor
718 event gen .t.f <Leave> -serial 103 -detail NotifyInferior
715 event generate .t.f <Enter> -serial 100 -detail NotifyAncestor
716 event generate .t.f <Enter> -serial 101 -detail NotifyInferior
717 event generate .t.f <Leave> -serial 102 -detail NotifyAncestor
718 event generate .t.f <Leave> -serial 103 -detail NotifyInferior
719719 return $x
720720 } -cleanup {
721721 destroy .t.f
728728 set x {}
729729 } -body {
730730 bind .t.f <Motion> "lappend x Motion%#(%x,%y)"
731 event gen .t.f <Motion> -serial 100 -x 100 -y 200 -when tail
732 update
733 event gen .t.f <Motion> -serial 101 -x 200 -y 300 -when tail
734 event gen .t.f <Motion> -serial 102 -x 300 -y 400 -when tail
731 event generate .t.f <Motion> -serial 100 -x 100 -y 200 -when tail
732 update
733 event generate .t.f <Motion> -serial 101 -x 200 -y 300 -when tail
734 event generate .t.f <Motion> -serial 102 -x 300 -y 400 -when tail
735735 update
736736 return $x
737737 } -cleanup {
745745 } -body {
746746 bind .t.f <Key> "lappend x %K%#"
747747 bind .t.f <KeyRelease> "lappend x %K%#"
748 event gen .t.f <Key-Shift_L> -serial 100 -when tail
749 event gen .t.f <KeyRelease-Shift_L> -serial 101 -when tail
750 event gen .t.f <Key-Shift_L> -serial 102 -when tail
751 event gen .t.f <KeyRelease-Shift_L> -serial 103 -when tail
748 event generate .t.f <Key-Shift_L> -serial 100 -when tail
749 event generate .t.f <KeyRelease-Shift_L> -serial 101 -when tail
750 event generate .t.f <Key-Shift_L> -serial 102 -when tail
751 event generate .t.f <KeyRelease-Shift_L> -serial 103 -when tail
752752 update
753753 } -cleanup {
754754 destroy .t.f
762762 } -body {
763763 bind .t.f <Key> "lappend x Key%K"
764764 bind .t.f <KeyRelease> "lappend x Release%K"
765 event gen .t.f <Key> -keysym a
766 event gen .t.f <KeyRelease> -keysym a
767 return $x
768 } -cleanup {
769 destroy .t.f
770 } -result {Keya Releasea}
765 event generate .t.f <Key> -keysym :
766 event generate .t.f <KeyRelease> -keysym :
767 return $x
768 } -cleanup {
769 destroy .t.f
770 } -result {Keycolon Releasecolon}
771771 test bind-13.14 {Tk_BindEvent procedure: invalid key detail} -setup {
772772 frame .t.f -class Test -width 150 -height 100
773773 pack .t.f
777777 } -body {
778778 bind .t.f <Key> "lappend x Key%K"
779779 bind .t.f <KeyRelease> "lappend x Release%K"
780 event gen .t.f <Key> -keycode 0
781 event gen .t.f <KeyRelease> -keycode 0
780 event generate .t.f <Key> -keycode 0
781 event generate .t.f <KeyRelease> -keycode 0
782782 return $x
783783 } -cleanup {
784784 destroy .t.f
792792 } -body {
793793 bind .t.f <Button> "lappend x Button%b"
794794 bind .t.f <ButtonRelease> "lappend x Release%b"
795 event gen .t.f <Button> -button 1
796 event gen .t.f <ButtonRelease> -button 3
795 event generate .t.f <Button> -button 1
796 event generate .t.f <ButtonRelease> -button 3
797797 set x
798798 } -cleanup {
799799 destroy .t.f
806806 set x {}
807807 } -body {
808808 bind .t.f <<Paste>> "lappend x Paste"
809 event gen .t.f <<Paste>>
809 event generate .t.f <<Paste>>
810810 return $x
811811 } -cleanup {
812812 destroy .t.f
819819 set x {}
820820 } -body {
821821 bind .t.f <<Paste>> "lappend x Paste"
822 event gen .t.f <<Paste>>
822 event generate .t.f <<Paste>>
823823 return $x
824824 } -cleanup {
825825 destroy .t.f
834834 bind .t.f <Button-2> {set x Button-2}
835835 event add <<Paste>> <Button-2>
836836 bind .t.f <<Paste>> {set x Paste}
837 event gen .t.f <Button-2>
837 event generate .t.f <Button-2>
838838 return $x
839839 } -cleanup {
840840 destroy .t.f
850850 } -body {
851851 event add <<Paste>> <Button-2>
852852 bind .t.f <<Paste>> {set x Paste}
853 event gen .t.f <Button-2>
853 event generate .t.f <Button-2>
854854 return $x
855855 } -cleanup {
856856 destroy .t.f
865865 } -body {
866866 event add <<Paste>> <Button-2>
867867 bind .t.f <<Paste>> "lappend x Paste"
868 event gen .t.f <Button-2>
868 event generate .t.f <Button-2>
869869 return $x
870870 } -cleanup {
871871 destroy .t.f
880880 } -body {
881881 event add <<Paste>> <Button-2>
882882 bind .t.f <<Paste>> "lappend x Paste"
883 event gen .t.f <Button>
883 event generate .t.f <Button>
884884 return $x
885885 } -cleanup {
886886 destroy .t.f
896896 bind .t.f <Button> {set x Button}
897897 event add <<Paste>> <Button>
898898 bind .t.f <<Paste>> {set x Paste}
899 event gen .t.f <Button-2>
899 event generate .t.f <Button-2>
900900 return $x
901901 } -cleanup {
902902 destroy .t.f
911911 } -body {
912912 event add <<Paste>> <Button>
913913 bind .t.f <<Paste>> {set x Paste}
914 event gen .t.f <Button-2>
914 event generate .t.f <Button-2>
915915 return $x
916916 } -cleanup {
917917 destroy .t.f
926926 } -body {
927927 event add <<Paste>> <Button>
928928 bind .t.f <<Paste>> "lappend x Paste"
929 event gen .t.f <Button-2>
929 event generate .t.f <Button-2>
930930 return $x
931931 } -cleanup {
932932 destroy .t.f
941941 } -body {
942942 event add <<Paste>> <Key>
943943 bind .t.f <<Paste>> "lappend x Paste"
944 event gen .t.f <Button>
944 event generate .t.f <Button>
945945 return $x
946946 } -cleanup {
947947 destroy .t.f
961961 bind .t.f <Button> "lappend x Button"
962962 bind .t.f <<Copy>> "lappend x Copy"
963963
964 event gen .t.f <Button-2>
964 event generate .t.f <Button-2>
965965 bind .t.f <Button-2> {}
966 event gen .t.f <Button-2>
966 event generate .t.f <Button-2>
967967 bind .t.f <<Paste>> {}
968 event gen .t.f <Button-2>
968 event generate .t.f <Button-2>
969969 bind .t.f <Button> {}
970 event gen .t.f <Button-2>
970 event generate .t.f <Button-2>
971971 bind .t.f <<Copy>> {}
972 event gen .t.f <Button-2>
972 event generate .t.f <Button-2>
973973 return $x
974974 } -cleanup {
975975 destroy .t.f
984984 set x {}
985985 } -body {
986986 bind .t.f <Button-2> {set x Button-2}
987 event gen .t.f <Button-2>
987 event generate .t.f <Button-2>
988988 return $x
989989 } -cleanup {
990990 destroy .t.f
998998 } -body {
999999 event add <<Paste>> <Button-2>
10001000 bind .t.f <<Paste>> {set x Paste}
1001 event gen .t.f <Button-2>
1001 event generate .t.f <Button-2>
10021002 return $x
10031003 } -cleanup {
10041004 destroy .t.f
10121012 set x {}
10131013 } -body {
10141014 bind .t.f <Button> {set x Button}
1015 event gen .t.f <Button-2>
1015 event generate .t.f <Button-2>
10161016 return $x
10171017 } -cleanup {
10181018 destroy .t.f
10261026 } -body {
10271027 event add <<Paste>> <Button>
10281028 bind .t.f <<Paste>> {set x Paste}
1029 event gen .t.f <Button-2>
1029 event generate .t.f <Button-2>
10301030 return $x
10311031 } -cleanup {
10321032 destroy .t.f
10381038 focus -force .t.f
10391039 update
10401040 } -body {
1041 event gen .t.f <Button-2>
1041 event generate .t.f <Button-2>
10421042 } -cleanup {
10431043 destroy .t.f
10441044 } -result {}
10501050 set x {}
10511051 } -body {
10521052 bind .t.f <Button-2> {set x Button-2}
1053 event gen .t.f <Button-2>
1053 event generate .t.f <Button-2>
10541054 return $x
10551055 } -cleanup {
10561056 destroy .t.f
10681068 foreach p [bindtags .t.f] {
10691069 testcbind $p <1> "lappend x $p"
10701070 }
1071 event gen .t.f <1>
1071 event generate .t.f <1>
10721072 return $x
10731073 } -cleanup {
10741074 foreach p [bindtags .t.f] {bind $p <1> {}}
10831083 } -body {
10841084 bind .t.f <Button-2> {lappend x .t.f}
10851085 bind Test <Button-2> {lappend x Button}
1086 event gen .t.f <Button-2>
1086 event generate .t.f <Button-2>
10871087 return $x
10881088 } -cleanup {
10891089 destroy .t.f
10991099 set x {}
11001100 } -body {
11011101 testcbind .t.f <1> {lappend x 1}
1102 event gen .t.f <1>
1102 event generate .t.f <1>
11031103 return $x
11041104 } -cleanup {
11051105 destroy .t.f
11151115 } -body {
11161116 testcbind Test <1> {lappend x Test} {lappend x Deleted}
11171117 bind .t.f <1> {lappend x .t.f; destroy .t.f}
1118 event gen .t.f <1>
1118 event generate .t.f <1>
11191119 set y [list $x [bind Test]]
11201120 return $y
11211121 } -cleanup {
11331133 } -body {
11341134 testcbind Test <1> {lappend x Test} {lappend x Deleted}
11351135 bind .t.f <1> {lappend x .t.f; bind Test <1> {}; lappend x after}
1136 event gen .t.f <1>
1136 event generate .t.f <1>
11371137 return $x
11381138 } -cleanup {
11391139 destroy .t.f
11501150 } -body {
11511151 testcbind Test <1> {lappend x Test}
11521152 bind .t.f <1> {lappend x .t.f}
1153 event gen .t.f <1>
1153 event generate .t.f <1>
11541154 return $x
11551155 } -cleanup {
11561156 destroy .t.f
11661166 set x {}
11671167 } -body {
11681168 testcbind .t.f <1> {lappend x hi; bind .t.f <1> {}} {lappend x bye}
1169 event gen .t.f <1>
1169 event generate .t.f <1>
11701170 return $x
11711171 } -cleanup {
11721172 destroy .t.f
11861186 bind .t.f <1> {}
11871187 } else {
11881188 set n [expr $n-1]
1189 event gen .t.f <1>
1189 event generate .t.f <1>
11901190 }
11911191 lappend x after$n
11921192 } {lappend x Deleted}
11931193 set n 3
1194 event gen .t.f <1>
1194 event generate .t.f <1>
11951195 return $x
11961196 } -cleanup {
11971197 destroy .t.f
12051205 } -body {
12061206 bind .t.f <Button-2> {lappend x b1; continue; lappend x b2}
12071207 bind Test <Button-2> {lappend x B1; continue; lappend x B2}
1208 event gen .t.f <Button-2>
1208 event generate .t.f <Button-2>
12091209 return $x
12101210 } -cleanup {
12111211 destroy .t.f
12221222 } -body {
12231223 testcbind .t.f <Button-2> {lappend x b1; continue; lappend x b2}
12241224 testcbind Test <Button-2> {lappend x B1; continue; lappend x B2}
1225 event gen .t.f <Button-2>
1225 event generate .t.f <Button-2>
12261226 return $x
12271227 } -cleanup {
12281228 destroy .t.f
12371237 } -body {
12381238 bind .t.f <Button-2> {lappend x b1; break; lappend x b2}
12391239 bind Test <Button-2> {lappend x B1; break; lappend x B2}
1240 event gen .t.f <Button-2>
1240 event generate .t.f <Button-2>
12411241 return $x
12421242 } -cleanup {
12431243 destroy .t.f
12541254 } -body {
12551255 testcbind .t.f <Button-2> {lappend x b1; break; lappend x b2}
12561256 testcbind Test <Button-2> {lappend x B1; break; lappend x B2}
1257 event gen .t.f <Button-2>
1257 event generate .t.f <Button-2>
12581258 return $x
12591259 } -cleanup {
12601260 destroy .t.f
12751275 } -body {
12761276 bind .t.f <Button-2> {lappend x b1; blap}
12771277 bind Test <Button-2> {lappend x B1}
1278 event gen .t.f <Button-2>
1278 event generate .t.f <Button-2>
12791279 update
12801280 return $x
12811281 } -cleanup {
12981298 } -body {
12991299 testcbind .t.f <Button-2> {lappend x b1; blap}
13001300 testcbind Test <Button-2> {lappend x B1}
1301 event gen .t.f <Button-2>
1301 event generate .t.f <Button-2>
13021302 update
13031303 return $x
13041304 } -cleanup {
13521352 testcbind b <1> "destroy .t.f; lappend x b1" "lappend x bye.t1"
13531353 testcbind c <1> "lappend x c1" "lappend x bye.c1"
13541354 testcbind d <1> "lappend x d1" "lappend x bye.d1"
1355 bind a <2> "event gen .t.f <1>"
1355 bind a <2> "event generate .t.f <1>"
13561356 testcbind b <2> "lappend x b2" "lappend x bye.t2"
13571357 testcbind c <2> "lappend x c2" "lappend x bye.d2"
13581358 bind d <2> "lappend x d2"
1359 testcbind a <3> "event gen .t.f <2>"
1360 event gen .t.f <3>
1359 testcbind a <3> "event generate .t.f <2>"
1360 event generate .t.f <3>
13611361 return $x
13621362 } -cleanup {
13631363 destroy .t.f
13741374 focus -force .t.f
13751375 update
13761376 } -body {
1377 bind .t.f 12 {set x 1}
1378 set x 0
1379 event generate .t.f <Key-1>
1380 event generate .t.f <KeyRelease-1>
1381 event generate .t.f <Key-2>
1382 event generate .t.f <KeyRelease-2>
1383 return $x
1384 } -cleanup {
1385 destroy .t.f
1386 } -result {1}
1387 test bind-15.2 {MatchPatterns procedure, ignoring type mismatches} -setup {
1388 frame .t.f -class Test -width 150 -height 100
1389 pack .t.f
1390 focus -force .t.f
1391 update
1392 } -body {
1393 bind .t.f 12 {set x 1}
1394 set x 0
1395 event generate .t.f <Key-1>
1396 event generate .t.f <Enter>
1397 event generate .t.f <KeyRelease-1>
1398 event generate .t.f <Leave>
1399 event generate .t.f <Key-2>
1400 event generate .t.f <KeyRelease-2>
1401 return $x
1402 } -cleanup {
1403 destroy .t.f
1404 } -result {1}
1405 test bind-15.3 {MatchPatterns procedure, ignoring type mismatches} -setup {
1406 frame .t.f -class Test -width 150 -height 100
1407 pack .t.f
1408 focus -force .t.f
1409 update
1410 } -body {
1411 bind .t.f 12 {set x 1}
1412 set x 0
1413 event generate .t.f <Key-1>
1414 event generate .t.f <Button-1>
1415 event generate .t.f <Key-2>
1416 return $x
1417 } -cleanup {
1418 destroy .t.f
1419 } -result {0}
1420 test bind-15.4 {MatchPatterns procedure, ignoring type mismatches} -setup {
1421 frame .t.f -class Test -width 150 -height 100
1422 pack .t.f
1423 focus -force .t.f
1424 update
1425 } -body {
1426 bind .t.f <Double-1> {set x 1}
1427 set x 0
1428 event generate .t.f <Button-1>
1429 event generate .t.f <ButtonRelease-1>
1430 event generate .t.f <Button-1>
1431 event generate .t.f <ButtonRelease-1>
1432 return $x
1433 } -cleanup {
1434 destroy .t.f
1435 } -result {1}
1436 test bind-15.5 {MatchPatterns procedure, ignoring type mismatches} -setup {
1437 frame .t.f -class Test -width 150 -height 100
1438 pack .t.f
1439 focus -force .t.f
1440 update
1441 } -body {
1442 bind .t.f <Double-ButtonRelease> {set x 1}
1443 set x 0
1444 event generate .t.f <Button-1>
1445 event generate .t.f <ButtonRelease-1>
1446 event generate .t.f <Button-2>
1447 event generate .t.f <ButtonRelease-2>
1448 return $x
1449 } -cleanup {
1450 destroy .t.f
1451 } -result {1}
1452 test bind-15.6 {MatchPatterns procedure, ignoring type mismatches} -setup {
1453 frame .t.f -class Test -width 150 -height 100
1454 pack .t.f
1455 focus -force .t.f
1456 update
1457 } -body {
1458 bind .t.f <Double-1> {set x 1}
1459 set x 0
1460 event generate .t.f <Button-1>
1461 event generate .t.f <Key-a>
1462 event generate .t.f <ButtonRelease-1>
1463 event generate .t.f <Button-1>
1464 event generate .t.f <ButtonRelease-1>
1465 return $x
1466 } -cleanup {
1467 destroy .t.f
1468 } -result {0}
1469 test bind-15.7 {MatchPatterns procedure, ignoring type mismatches} -setup {
1470 frame .t.f -class Test -width 150 -height 100
1471 pack .t.f
1472 focus -force .t.f
1473 update
1474 } -body {
1475 bind .t.f <Double-1> {set x 1}
1476 set x 0
1477 event generate .t.f <Button-1>
1478 event generate .t.f <Key-Shift_L>
1479 event generate .t.f <ButtonRelease-1>
1480 event generate .t.f <Button-1>
1481 event generate .t.f <ButtonRelease-1>
1482 return $x
1483 } -cleanup {
1484 destroy .t.f
1485 } -result {1}
1486 test bind-15.8 {MatchPatterns procedure, ignoring type mismatches} -setup {
1487 frame .t.f -class Test -width 150 -height 100
1488 pack .t.f
1489 focus -force .t.f
1490 update
1491 } -body {
13771492 bind .t.f ab {set x 1}
13781493 set x 0
1379 event gen .t.f <Key-a>
1380 event gen .t.f <KeyRelease-a>
1381 event gen .t.f <Key-b>
1382 event gen .t.f <KeyRelease-b>
1383 return $x
1384 } -cleanup {
1385 destroy .t.f
1386 } -result {1}
1387 test bind-15.2 {MatchPatterns procedure, ignoring type mismatches} -setup {
1388 frame .t.f -class Test -width 150 -height 100
1389 pack .t.f
1390 focus -force .t.f
1391 update
1392 } -body {
1393 bind .t.f ab {set x 1}
1394 set x 0
1395 event gen .t.f <Key-a>
1396 event gen .t.f <Enter>
1397 event gen .t.f <KeyRelease-a>
1398 event gen .t.f <Leave>
1399 event gen .t.f <Key-b>
1400 event gen .t.f <KeyRelease-b>
1401 return $x
1402 } -cleanup {
1403 destroy .t.f
1404 } -result {1}
1405 test bind-15.3 {MatchPatterns procedure, ignoring type mismatches} -setup {
1406 frame .t.f -class Test -width 150 -height 100
1407 pack .t.f
1408 focus -force .t.f
1409 update
1410 } -body {
1411 bind .t.f ab {set x 1}
1412 set x 0
1413 event gen .t.f <Key-a>
1414 event gen .t.f <Button-1>
1415 event gen .t.f <Key-b>
1416 return $x
1417 } -cleanup {
1418 destroy .t.f
1419 } -result {0}
1420 test bind-15.4 {MatchPatterns procedure, ignoring type mismatches} -setup {
1421 frame .t.f -class Test -width 150 -height 100
1422 pack .t.f
1423 focus -force .t.f
1424 update
1425 } -body {
1426 bind .t.f <Double-1> {set x 1}
1427 set x 0
1428 event gen .t.f <Button-1>
1429 event gen .t.f <ButtonRelease-1>
1430 event gen .t.f <Button-1>
1431 event gen .t.f <ButtonRelease-1>
1432 return $x
1433 } -cleanup {
1434 destroy .t.f
1435 } -result {1}
1436 test bind-15.5 {MatchPatterns procedure, ignoring type mismatches} -setup {
1437 frame .t.f -class Test -width 150 -height 100
1438 pack .t.f
1439 focus -force .t.f
1440 update
1441 } -body {
1442 bind .t.f <Double-ButtonRelease> {set x 1}
1443 set x 0
1444 event gen .t.f <Button-1>
1445 event gen .t.f <ButtonRelease-1>
1446 event gen .t.f <Button-2>
1447 event gen .t.f <ButtonRelease-2>
1448 return $x
1449 } -cleanup {
1450 destroy .t.f
1451 } -result {1}
1452 test bind-15.6 {MatchPatterns procedure, ignoring type mismatches} -setup {
1453 frame .t.f -class Test -width 150 -height 100
1454 pack .t.f
1455 focus -force .t.f
1456 update
1457 } -body {
1458 bind .t.f <Double-1> {set x 1}
1459 set x 0
1460 event gen .t.f <Button-1>
1461 event gen .t.f <Key-a>
1462 event gen .t.f <ButtonRelease-1>
1463 event gen .t.f <Button-1>
1464 event gen .t.f <ButtonRelease-1>
1465 return $x
1466 } -cleanup {
1467 destroy .t.f
1468 } -result {0}
1469 test bind-15.7 {MatchPatterns procedure, ignoring type mismatches} -setup {
1470 frame .t.f -class Test -width 150 -height 100
1471 pack .t.f
1472 focus -force .t.f
1473 update
1474 } -body {
1475 bind .t.f <Double-1> {set x 1}
1476 set x 0
1477 event gen .t.f <Button-1>
1478 event gen .t.f <Key-Shift_L>
1479 event gen .t.f <ButtonRelease-1>
1480 event gen .t.f <Button-1>
1481 event gen .t.f <ButtonRelease-1>
1482 return $x
1483 } -cleanup {
1484 destroy .t.f
1485 } -result {1}
1486 test bind-15.8 {MatchPatterns procedure, ignoring type mismatches} -setup {
1487 frame .t.f -class Test -width 150 -height 100
1488 pack .t.f
1489 focus -force .t.f
1490 update
1491 } -body {
1492 bind .t.f ab {set x 1}
1493 set x 0
1494 event gen .t.f <Key-a>
1495 event gen .t.f <Key-c>
1496 event gen .t.f <Key-b>
1494 event generate .t.f <Key-a>
1495 event generate .t.f <Key-c>
1496 event generate .t.f <Key-b>
14971497 return $x
14981498 } -cleanup {
14991499 destroy .t.f
15061506 } -body {
15071507 bind .t.f <M1-M2-Key> {set x 1}
15081508 set x 0
1509 event gen .t.f <Key-a> -state 0x18
1509 event generate .t.f <Key-a> -state 0x18
15101510 return $x
15111511 } -cleanup {
15121512 destroy .t.f
15191519 } -body {
15201520 bind .t.f <M1-M2-Key> {set x 1}
15211521 set x 0
1522 event gen .t.f <Key-a> -state 0xfc
1522 event generate .t.f <Key-a> -state 0xfc
15231523 return $x
15241524 } -cleanup {
15251525 destroy .t.f
15321532 } -body {
15331533 bind .t.f <M1-M2-Key> {set x 1}
15341534 set x 0
1535 event gen .t.f <Key-a> -state 0x8
1535 event generate .t.f <Key-a> -state 0x8
15361536 return $x
15371537 } -cleanup {
15381538 destroy .t.f
15491549 # differently on some platforms.
15501550 bind .t.f aB {set x 1}
15511551 set x 0
1552 event gen .t.f <Key-a>
1553 event gen .t.f <Key-Shift_L>
1554 event gen .t.f <Key-b> -state 1
1552 event generate .t.f <Key-a>
1553 event generate .t.f <Key-Shift_L>
1554 event generate .t.f <Key-b> -state 1
15551555 return $x
15561556 } -cleanup {
15571557 destroy .t.f
15641564 } -body {
15651565 bind .t.f ab {set x 1}
15661566 set x 0
1567 event gen .t.f <Key-a>
1568 event gen .t.f <Key-c>
1567 event generate .t.f <Key-a>
1568 event generate .t.f <Key-c>
15691569 return $x
15701570 } -cleanup {
15711571 destroy .t.f
15781578 } -body {
15791579 bind .t.f <Double-1> {set x 1}
15801580 set x 0
1581 event gen .t.f <Button-2>
1582 event gen .t.f <ButtonRelease-2>
1583 event gen .t.f <Button-1> -x 30 -y 40
1584 event gen .t.f <Button-1> -x 31 -y 39
1585 event gen .t.f <ButtonRelease-1>
1581 event generate .t.f <Button-2>
1582 event generate .t.f <ButtonRelease-2>
1583 event generate .t.f <Button-1> -x 30 -y 40
1584 event generate .t.f <Button-1> -x 31 -y 39
1585 event generate .t.f <ButtonRelease-1>
15861586 return $x
15871587 } -cleanup {
15881588 destroy .t.f
15951595 } -body {
15961596 bind .t.f <Double-1> {set x 1}
15971597 set x 0
1598 event gen .t.f <Button-2>
1599 event gen .t.f <ButtonRelease-2>
1600 event gen .t.f <Button-1> -x 30 -y 40
1601 event gen .t.f <Button-1> -x 29 -y 41
1602 event gen .t.f <ButtonRelease-1>
1598 event generate .t.f <Button-2>
1599 event generate .t.f <ButtonRelease-2>
1600 event generate .t.f <Button-1> -x 30 -y 40
1601 event generate .t.f <Button-1> -x 29 -y 41
1602 event generate .t.f <ButtonRelease-1>
16031603 return $x
16041604 } -cleanup {
16051605 destroy .t.f
16121612 } -body {
16131613 bind .t.f <Double-1> {set x 1}
16141614 set x 0
1615 event gen .t.f <Button-2>
1616 event gen .t.f <ButtonRelease-2>
1617 event gen .t.f <Button-1> -x 30 -y 40
1618 event gen .t.f <Button-1> -x 40 -y 40
1619 event gen .t.f <ButtonRelease-2>
1615 event generate .t.f <Button-2>
1616 event generate .t.f <ButtonRelease-2>
1617 event generate .t.f <Button-1> -x 30 -y 40
1618 event generate .t.f <Button-1> -x 40 -y 40
1619 event generate .t.f <ButtonRelease-2>
16201620 return $x
16211621 } -cleanup {
16221622 destroy .t.f
16291629 } -body {
16301630 bind .t.f <Double-1> {set x 1}
16311631 set x 0
1632 event gen .t.f <Button-2>
1633 event gen .t.f <ButtonRelease-2>
1634 event gen .t.f <Button-1> -x 30 -y 40
1635 event gen .t.f <Button-1> -x 20 -y 40
1636 event gen .t.f <ButtonRelease-1>
1632 event generate .t.f <Button-2>
1633 event generate .t.f <ButtonRelease-2>
1634 event generate .t.f <Button-1> -x 30 -y 40
1635 event generate .t.f <Button-1> -x 20 -y 40
1636 event generate .t.f <ButtonRelease-1>
16371637 return $x
16381638 } -cleanup {
16391639 destroy .t.f
16461646 } -body {
16471647 bind .t.f <Double-1> {set x 1}
16481648 set x 0
1649 event gen .t.f <Button-2>
1650 event gen .t.f <ButtonRelease-2>
1651 event gen .t.f <Button-1> -x 30 -y 40
1652 event gen .t.f <Button-1> -x 30 -y 30
1653 event gen .t.f <ButtonRelease-1>
1649 event generate .t.f <Button-2>
1650 event generate .t.f <ButtonRelease-2>
1651 event generate .t.f <Button-1> -x 30 -y 40
1652 event generate .t.f <Button-1> -x 30 -y 30
1653 event generate .t.f <ButtonRelease-1>
16541654 return $x
16551655 } -cleanup {
16561656 destroy .t.f
16631663 } -body {
16641664 bind .t.f <Double-1> {set x 1}
16651665 set x 0
1666 event gen .t.f <Button-2>
1667 event gen .t.f <ButtonRelease-2>
1668 event gen .t.f <Button-1> -x 30 -y 40
1669 event gen .t.f <Button-1> -x 30 -y 50
1670 event gen .t.f <ButtonRelease-1>
1666 event generate .t.f <Button-2>
1667 event generate .t.f <ButtonRelease-2>
1668 event generate .t.f <Button-1> -x 30 -y 40
1669 event generate .t.f <Button-1> -x 30 -y 50
1670 event generate .t.f <ButtonRelease-1>
16711671 return $x
16721672 } -cleanup {
16731673 destroy .t.f
16801680 } -body {
16811681 bind .t.f <Double-1> {set x 1}
16821682 set x 0
1683 event gen .t.f <Button-2>
1684 event gen .t.f <ButtonRelease-2>
1685 event gen .t.f <Button-1> -time 300
1686 event gen .t.f <Button-1> -time 700
1687 event gen .t.f <ButtonRelease-1>
1683 event generate .t.f <Button-2>
1684 event generate .t.f <ButtonRelease-2>
1685 event generate .t.f <Button-1> -time 300
1686 event generate .t.f <Button-1> -time 700
1687 event generate .t.f <ButtonRelease-1>
16881688 return $x
16891689 } -cleanup {
16901690 destroy .t.f
16971697 } -body {
16981698 bind .t.f <Double-1> {set x 1}
16991699 set x 0
1700 event gen .t.f <Button-2>
1701 event gen .t.f <ButtonRelease-2>
1702 event gen .t.f <Button-1> -time 300
1703 event gen .t.f <Button-1> -time 900
1704 event gen .t.f <ButtonRelease-1>
1700 event generate .t.f <Button-2>
1701 event generate .t.f <ButtonRelease-2>
1702 event generate .t.f <Button-1> -time 300
1703 event generate .t.f <Button-1> -time 900
1704 event generate .t.f <ButtonRelease-1>
17051705 return $x
17061706 } -cleanup {
17071707 destroy .t.f
17141714 } -body {
17151715 bind .t.f <Double-1> {set x 1}
17161716 set x 0
1717 event gen .t.f <Button-1> -time [expr -100]
1718 event gen .t.f <Button-1> -time 200
1719 event gen .t.f <ButtonRelease-1>
1717 event generate .t.f <Button-1> -time [expr -100]
1718 event generate .t.f <Button-1> -time 200
1719 event generate .t.f <ButtonRelease-1>
17201720 return $x
17211721 } -cleanup {
17221722 destroy .t.f
17291729 } -body {
17301730 bind .t.f <Double-1> {set x 1}
17311731 set x 0
1732 event gen .t.f <Button-1> -time -100
1733 event gen .t.f <Button-1> -time 500
1734 event gen .t.f <ButtonRelease-1>
1732 event generate .t.f <Button-1> -time -100
1733 event generate .t.f <Button-1> -time 500
1734 event generate .t.f <ButtonRelease-1>
17351735 return $x
17361736 } -cleanup {
17371737 destroy .t.f
17461746 } -body {
17471747 event add <<Paste>> <Button-1>
17481748 bind .t.f <<Paste>> {lappend x paste}
1749 event gen .t.f <Button-1>
1750 event gen .t.f <ButtonRelease-1>
1749 event generate .t.f <Button-1>
1750 event generate .t.f <ButtonRelease-1>
17511751 set x
17521752 } -cleanup {
17531753 destroy .t.f
17621762 } -body {
17631763 event add <<Paste>> <Shift-Button-1>
17641764 bind .t.f <<Paste>> {lappend x paste}
1765 event gen .t.f <Button-1>
1766 event gen .t.f <ButtonRelease-1>
1765 event generate .t.f <Button-1>
1766 event generate .t.f <ButtonRelease-1>
17671767 set x
17681768 } -cleanup {
17691769 destroy .t.f
17801780 event add <<V2>> <Button-1>
17811781 event add <<V3>> <Shift-Button-1>
17821782 bind .t.f <<V2>> "lappend x V2%#"
1783 event gen .t.f <Button> -serial 101
1784 event gen .t.f <Button-1> -serial 102
1785 event gen .t.f <Shift-Button-1> -serial 103
1786 event gen .t.f <ButtonRelease-1>
1783 event generate .t.f <Button> -serial 101
1784 event generate .t.f <Button-1> -serial 102
1785 event generate .t.f <Shift-Button-1> -serial 103
1786 event generate .t.f <ButtonRelease-1>
17871787 bind .t.f <Shift-Button-1> "lappend x Shift-Button-1"
1788 event gen .t.f <Button> -serial 104
1789 event gen .t.f <Button-1> -serial 105
1790 event gen .t.f <Shift-Button-1> -serial 106
1791 event gen .t.f <ButtonRelease-1>
1788 event generate .t.f <Button> -serial 104
1789 event generate .t.f <Button-1> -serial 105
1790 event generate .t.f <Shift-Button-1> -serial 106
1791 event generate .t.f <ButtonRelease-1>
17921792 set x
17931793 } -cleanup {
17941794 destroy .t.f
18031803 update
18041804 } -body {
18051805 bind .t.f <KeyPress> {set x 0}
1806 bind .t.f a {set x 1}
1806 bind .t.f 1 {set x 1}
18071807 set x none
1808 event gen .t.f <Key-a>
1808 event generate .t.f <Key-1>
18091809 return $x
18101810 } -cleanup {
18111811 destroy .t.f
18171817 update
18181818 } -body {
18191819 bind .t.f <KeyPress> {set x 0}
1820 bind .t.f a {set x 1}
1820 bind .t.f 1 {set x 1}
18211821 set x none
1822 event gen .t.f <Key-b>
1822 event generate .t.f <Key-2>
18231823 return $x
18241824 } -cleanup {
18251825 destroy .t.f
18311831 update
18321832 } -body {
18331833 bind .t.f <KeyPress> {lappend x 0}
1834 bind .t.f a {lappend x 1}
1835 bind .t.f ba {lappend x 2}
1834 bind .t.f 1 {lappend x 1}
1835 bind .t.f 21 {lappend x 2}
18361836 set x none
1837 event gen .t.f <Key-b>
1838 event gen .t.f <KeyRelease-b>
1839 event gen .t.f <Key-a>
1837 event generate .t.f <Key-2>
1838 event generate .t.f <KeyRelease-2>
1839 event generate .t.f <Key-1>
18401840 set x
18411841 } -cleanup {
18421842 destroy .t.f
18501850 bind .t.f <ButtonPress> {set x 0}
18511851 bind .t.f <1> {set x 1}
18521852 set x none
1853 event gen .t.f <Button-1>
1854 event gen .t.f <ButtonRelease-1>
1853 event generate .t.f <Button-1>
1854 event generate .t.f <ButtonRelease-1>
18551855 return $x
18561856 } -cleanup {
18571857 destroy .t.f
18651865 } -body {
18661866 bind .t.f <M1-Key> {set x 0}
18671867 bind .t.f <M2-Key> {set x 1}
1868 event gen .t.f <Key-a> -state 0x18
1868 event generate .t.f <Key-a> -state 0x18
18691869 return $x
18701870 } -cleanup {
18711871 destroy .t.f
18791879 bind .t.f <M2-Key> {set x 0}
18801880 bind .t.f <M1-Key> {set x 1}
18811881 set x none
1882 event gen .t.f <Key-a> -state 0x18
1882 event generate .t.f <Key-a> -state 0x18
18831883 return $x
18841884 } -cleanup {
18851885 destroy .t.f
18941894 bind .t.f <1> {lappend x single}
18951895 bind Test <1> {lappend x single(Test)}
18961896 bind Test <Double-1> {lappend x double(Test)}
1897 event gen .t.f <Button-1>
1898 event gen .t.f <Button-1>
1899 event gen .t.f <Button-1>
1900 event gen .t.f <ButtonRelease-1>
1897 event generate .t.f <Button-1>
1898 event generate .t.f <Button-1>
1899 event generate .t.f <Button-1>
1900 event generate .t.f <ButtonRelease-1>
19011901 set x
19021902 } -cleanup {
19031903 destroy .t.f
19141914 } -body {
19151915 bind .t.f <Enter> {set x abcd}
19161916 set x none
1917 event gen .t.f <Enter>
1917 event generate .t.f <Enter>
19181918 set x
19191919 } -cleanup {
19201920 destroy .t.f
19271927 } -body {
19281928 bind .t.f <Enter> {set x %#}
19291929 set x none
1930 event gen .t.f <Enter> -serial 1234
1930 event generate .t.f <Enter> -serial 1234
19311931 set x
19321932 } -cleanup {
19331933 destroy .t.f
19401940 } -body {
19411941 bind .t.f <Configure> {set x %a}
19421942 set x none
1943 event gen .t.f <Configure> -above .t -window .t.f
1943 event generate .t.f <Configure> -above .t -window .t.f
19441944 set x
19451945 } -cleanup {
19461946 destroy .t.f
19531953 } -body {
19541954 bind .t.f <Button> {set x %b}
19551955 set x none
1956 event gen .t.f <Button-3>
1957 event gen .t.f <ButtonRelease-3>
1956 event generate .t.f <Button-3>
1957 event generate .t.f <ButtonRelease-3>
19581958 set x
19591959 } -cleanup {
19601960 destroy .t.f
19671967 } -body {
19681968 bind .t.f <Expose> {set x %c}
19691969 set x none
1970 event gen .t.f <Expose> -count 47
1970 event generate .t.f <Expose> -count 47
19711971 set x
19721972 } -cleanup {
19731973 destroy .t.f
19801980 } -body {
19811981 bind .t.f <Enter> {set x %d}
19821982 set x none
1983 event gen .t.f <Enter> -detail NotifyAncestor
1983 event generate .t.f <Enter> -detail NotifyAncestor
19841984 set x
19851985 } -cleanup {
19861986 destroy .t.f
19931993 } -body {
19941994 bind .t.f <Enter> {set x %d}
19951995 set x none
1996 event gen .t.f <Enter> -detail NotifyVirtual
1996 event generate .t.f <Enter> -detail NotifyVirtual
19971997 set x
19981998 } -cleanup {
19991999 destroy .t.f
20062006 } -body {
20072007 bind .t.f <Enter> {set x %d}
20082008 set x none
2009 event gen .t.f <Enter> -detail NotifyNonlinear
2009 event generate .t.f <Enter> -detail NotifyNonlinear
20102010 set x
20112011 } -cleanup {
20122012 destroy .t.f
20192019 } -body {
20202020 bind .t.f <Enter> {set x %d}
20212021 set x none
2022 event gen .t.f <Enter> -detail NotifyNonlinearVirtual
2022 event generate .t.f <Enter> -detail NotifyNonlinearVirtual
20232023 set x
20242024 } -cleanup {
20252025 destroy .t.f
20322032 } -body {
20332033 bind .t.f <Enter> {set x %d}
20342034 set x none
2035 event gen .t.f <Enter> -detail NotifyPointer
2035 event generate .t.f <Enter> -detail NotifyPointer
20362036 set x
20372037 } -cleanup {
20382038 destroy .t.f
20452045 } -body {
20462046 bind .t.f <Enter> {set x %d}
20472047 set x none
2048 event gen .t.f <Enter> -detail NotifyPointerRoot
2048 event generate .t.f <Enter> -detail NotifyPointerRoot
20492049 set x
20502050 } -cleanup {
20512051 destroy .t.f
20582058 } -body {
20592059 bind .t.f <Enter> {set x %d}
20602060 set x none
2061 event gen .t.f <Enter> -detail NotifyDetailNone
2061 event generate .t.f <Enter> -detail NotifyDetailNone
20622062 set x
20632063 } -cleanup {
20642064 destroy .t.f
20712071 } -body {
20722072 bind .t.f <Enter> {set x %f}
20732073 set x none
2074 event gen .t.f <Enter> -focus 1
2074 event generate .t.f <Enter> -focus 1
20752075 return $x
20762076 } -cleanup {
20772077 destroy .t.f
20842084 } -body {
20852085 bind .t.f <Expose> {set x "%x %y %w %h"}
20862086 set x none
2087 event gen .t.f <Expose> -x 24 -y 18 -width 147 -height 61
2087 event generate .t.f <Expose> -x 24 -y 18 -width 147 -height 61
20882088 set x
20892089 } -cleanup {
20902090 destroy .t.f
20972097 } -body {
20982098 bind .t.f <Configure> {set x "%x %y %w %h"}
20992099 set x none
2100 event gen .t.f <Configure> -x 24 -y 18 -width 147 -height 61 -window .t.f
2100 event generate .t.f <Configure> -x 24 -y 18 -width 147 -height 61 -window .t.f
21012101 set x
21022102 } -cleanup {
21032103 destroy .t.f
21102110 } -body {
21112111 bind .t.f <Key> {set x "%k"}
21122112 set x none
2113 event gen .t.f <Key> -keycode 146
2113 event generate .t.f <Key> -keycode 146
21142114 set x
21152115 } -cleanup {
21162116 destroy .t.f
21232123 } -body {
21242124 bind .t.f <Enter> {set x "%m"}
21252125 set x none
2126 event gen .t.f <Enter> -mode NotifyNormal
2126 event generate .t.f <Enter> -mode NotifyNormal
21272127 set x
21282128 } -cleanup {
21292129 destroy .t.f
21362136 } -body {
21372137 bind .t.f <Enter> {set x "%m"}
21382138 set x none
2139 event gen .t.f <Enter> -mode NotifyGrab
2139 event generate .t.f <Enter> -mode NotifyGrab
21402140 set x
21412141 } -cleanup {
21422142 destroy .t.f
21492149 } -body {
21502150 bind .t.f <Enter> {set x "%m"}
21512151 set x none
2152 event gen .t.f <Enter> -mode NotifyUngrab
2152 event generate .t.f <Enter> -mode NotifyUngrab
21532153 set x
21542154 } -cleanup {
21552155 destroy .t.f
21632163 } -body {
21642164 bind .t.f <Enter> {set x "%m"}
21652165 set x none
2166 event gen .t.f <Enter> -mode NotifyWhileGrabbed
2166 event generate .t.f <Enter> -mode NotifyWhileGrabbed
21672167 set x
21682168 } -cleanup {
21692169 destroy .t.f
21762176 } -body {
21772177 bind .t.f <Map> {set x "%o"}
21782178 set x none
2179 event gen .t.f <Map> -override 1 -window .t.f
2179 event generate .t.f <Map> -override 1 -window .t.f
21802180 return $x
21812181 } -cleanup {
21822182 destroy .t.f
21892189 } -body {
21902190 bind .t.f <Reparent> {set x "%o"}
21912191 set x none
2192 event gen .t.f <Reparent> -override true -window .t.f
2192 event generate .t.f <Reparent> -override true -window .t.f
21932193 return $x
21942194 } -cleanup {
21952195 destroy .t.f
22022202 } -body {
22032203 bind .t.f <Configure> {set x "%o"}
22042204 set x none
2205 event gen .t.f <Configure> -override 1 -window .t.f
2205 event generate .t.f <Configure> -override 1 -window .t.f
22062206 return $x
22072207 } -cleanup {
22082208 destroy .t.f
22152215 } -body {
22162216 bind .t.f <Circulate> {set x "%p"}
22172217 set x none
2218 event gen .t.f <Circulate> -place PlaceOnTop -window .t.f
2218 event generate .t.f <Circulate> -place PlaceOnTop -window .t.f
22192219 set x
22202220 } -cleanup {
22212221 destroy .t.f
22282228 } -body {
22292229 bind .t.f <Circulate> {set x "%p"}
22302230 set x none
2231 event gen .t.f <Circulate> -place PlaceOnBottom -window .t.f
2231 event generate .t.f <Circulate> -place PlaceOnBottom -window .t.f
22322232 set x
22332233 } -cleanup {
22342234 destroy .t.f
22412241 } -body {
22422242 bind .t.f <1> {set x "%s"}
22432243 set x none
2244 event gen .t.f <Button-1> -state 1402
2245 event gen .t.f <ButtonRelease-1>
2244 event generate .t.f <Button-1> -state 1402
2245 event generate .t.f <ButtonRelease-1>
22462246 set x
22472247 } -cleanup {
22482248 destroy .t.f
22552255 } -body {
22562256 bind .t.f <Enter> {set x "%s"}
22572257 set x none
2258 event gen .t.f <Enter> -state 0x3ff
2258 event generate .t.f <Enter> -state 0x3ff
22592259 set x
22602260 } -cleanup {
22612261 destroy .t.f
22682268 } -body {
22692269 bind .t.f <Visibility> {set x "%s"}
22702270 set x none
2271 event gen .t.f <Visibility> -state VisibilityPartiallyObscured
2271 event generate .t.f <Visibility> -state VisibilityPartiallyObscured
22722272 set x
22732273 } -cleanup {
22742274 destroy .t.f
22812281 } -body {
22822282 bind .t.f <Visibility> {set x "%s"}
22832283 set x none
2284 event gen .t.f <Visibility> -state VisibilityUnobscured
2284 event generate .t.f <Visibility> -state VisibilityUnobscured
22852285 set x
22862286 } -cleanup {
22872287 destroy .t.f
22942294 } -body {
22952295 bind .t.f <Visibility> {set x "%s"}
22962296 set x none
2297 event gen .t.f <Visibility> -state VisibilityFullyObscured
2297 event generate .t.f <Visibility> -state VisibilityFullyObscured
22982298 set x
22992299 } -cleanup {
23002300 destroy .t.f
23072307 } -body {
23082308 bind .t.f <Button> {set x "%t"}
23092309 set x none
2310 event gen .t.f <Button> -time 4294
2311 event gen .t.f <ButtonRelease>
2310 event generate .t.f <Button> -time 4294
2311 event generate .t.f <ButtonRelease>
23122312 set x
23132313 } -cleanup {
23142314 destroy .t.f
23212321 } -body {
23222322 bind .t.f <Button> {set x "%x %y"}
23232323 set x none
2324 event gen .t.f <Button> -x 881 -y 432
2325 event gen .t.f <ButtonRelease>
2324 event generate .t.f <Button> -x 881 -y 432
2325 event generate .t.f <ButtonRelease>
23262326 set x
23272327 } -cleanup {
23282328 destroy .t.f
23352335 } -body {
23362336 bind .t.f <Reparent> {set x "%x %y"}
23372337 set x none
2338 event gen .t.f <Reparent> -x 882 -y 431 -window .t.f
2338 event generate .t.f <Reparent> -x 882 -y 431 -window .t.f
23392339 set x
23402340 } -cleanup {
23412341 destroy .t.f
23482348 } -body {
23492349 bind .t.f <Enter> {set x "%x %y"}
23502350 set x none
2351 event gen .t.f <Enter> -x 781 -y 632
2351 event generate .t.f <Enter> -x 781 -y 632
23522352 set x
23532353 } -cleanup {
23542354 destroy .t.f
23632363 set x {}
23642364 } -body {
23652365 bind .t.f <Key> {lappend x "%A"}
2366 event gen .t.f <Key-a>
2367 event gen .t.f <Key-A> -state 1
2368 event gen .t.f <Key-Tab>
2369 event gen .t.f <Key-Return>
2370 event gen .t.f <Key-F1>
2371 event gen .t.f <Key-Shift_L>
2372 event gen .t.f <Key-space>
2373 event gen .t.f <Key-dollar> -state 1
2374 event gen .t.f <Key-braceleft> -state 1
2375 event gen .t.f <Key-Multi_key>
2376 event gen .t.f <Key-e>
2377 event gen .t.f <Key-apostrophe>
2366 event generate .t.f <Key-a>
2367 event generate .t.f <Key-A> -state 1
2368 event generate .t.f <Key-Tab>
2369 event generate .t.f <Key-Return>
2370 event generate .t.f <Key-F1>
2371 event generate .t.f <Key-Shift_L>
2372 event generate .t.f <Key-space>
2373 event generate .t.f <Key-dollar> -state 1
2374 event generate .t.f <Key-braceleft> -state 1
2375 event generate .t.f <Key-Multi_key>
2376 event generate .t.f <Key-e>
2377 event generate .t.f <Key-apostrophe>
23782378 set x
23792379 } -cleanup {
23802380 destroy .t.f
23872387 } -body {
23882388 bind .t.f <Configure> {set x "%B"}
23892389 set x none
2390 event gen .t.f <Configure> -borderwidth 24 -window .t.f
2390 event generate .t.f <Configure> -borderwidth 24 -window .t.f
23912391 set x
23922392 } -cleanup {
23932393 destroy .t.f
24002400 } -body {
24012401 bind .t.f <Enter> {set x "%E"}
24022402 set x none
2403 event gen .t.f <Enter> -sendevent 1
2403 event generate .t.f <Enter> -sendevent 1
24042404 return $x
24052405 } -cleanup {
24062406 destroy .t.f
24152415 set x {}
24162416 } -body {
24172417 bind .t.f <Key> {lappend x %K}
2418 event gen .t.f <Key-a>
2419 event gen .t.f <Key-A> -state 1
2420 event gen .t.f <Key-Tab>
2421 event gen .t.f <Key-F1>
2422 event gen .t.f <Key-Shift_L>
2423 event gen .t.f <Key-space>
2424 event gen .t.f <Key-dollar> -state 1
2425 event gen .t.f <Key-braceleft> -state 1
2418 event generate .t.f <Key-a>
2419 event generate .t.f <Key-A> -state 1
2420 event generate .t.f <Key-Tab>
2421 event generate .t.f <Key-F1>
2422 event generate .t.f <Key-Shift_L>
2423 event generate .t.f <Key-space>
2424 event generate .t.f <Key-dollar> -state 1
2425 event generate .t.f <Key-braceleft> -state 1
24262426 set x
24272427 } -cleanup {
24282428 destroy .t.f
24352435 } -body {
24362436 bind .t.f <Key> {set x "%N"}
24372437 set x none
2438 event gen .t.f <Key-a>
2439 set x
2440 } -cleanup {
2441 destroy .t.f
2442 } -result {97}
2438 event generate .t.f <Key-space>
2439 set x
2440 } -cleanup {
2441 destroy .t.f
2442 } -result {32}
24432443 test bind-16.40 {ExpandPercents procedure} -setup {
24442444 frame .t.f -class Test -width 150 -height 100
24452445 pack .t.f
24482448 } -body {
24492449 bind .t.f <Key> {set x "%S"}
24502450 set x none
2451 event gen .t.f <Key-a> -subwindow .t
2451 event generate .t.f <Key-space> -subwindow .t
24522452 set x
24532453 } -cleanup {
24542454 destroy .t.f
24612461 } -body {
24622462 bind .t.f <Key> {set x "%T"}
24632463 set x none
2464 event gen .t.f <Key>
2464 event generate .t.f <Key>
24652465 set x
24662466 } -cleanup {
24672467 destroy .t.f
24752475 } -body {
24762476 bind .t.f <Key> {set x "%W"}
24772477 set x none
2478 event gen .t.f <Key>
2478 event generate .t.f <Key>
24792479 set x
24802480 } -cleanup {
24812481 destroy .t.f
24882488 } -body {
24892489 bind .t.f <Button> {set x "%X %Y"}
24902490 set x none
2491 event gen .t.f <Button> -rootx 422 -rooty 13
2492 event gen .t.f <ButtonRelease>
2491 event generate .t.f <Button> -rootx 422 -rooty 13
2492 event generate .t.f <ButtonRelease>
24932493 set x
24942494 } -cleanup {
24952495 destroy .t.f
25022502 } -body {
25032503 bind .t.f <Gravity> {set x "%R %S"}
25042504 set x none
2505 event gen .t.f <Gravity>
2505 event generate .t.f <Gravity>
25062506 set x
25072507 } -cleanup {
25082508 destroy .t.f
27422742 } -body {
27432743 event add <<xyz>> <Button-2>
27442744 bind .t.f <<xyz>> {lappend x %#}
2745 event gen .t.f <Button-2> -serial 101
2746 event gen .t.f <ButtonRelease-2>
2745 event generate .t.f <Button-2> -serial 101
2746 event generate .t.f <ButtonRelease-2>
27472747 event delete <<xyz>>
2748 event gen .t.f <Button-2> -serial 102
2749 event gen .t.f <ButtonRelease-2>
2748 event generate .t.f <Button-2> -serial 102
2749 event generate .t.f <ButtonRelease-2>
27502750 set x
27512751 } -cleanup {
27522752 destroy .t.f
27642764 event add <<xyz>> <Button-2>
27652765 bind .t.f <<xyz>> {lappend x xyz}
27662766 bind .t.f <<abc>> {lappend x abc}
2767 event gen .t.f <Button-2>
2768 event gen .t.f <ButtonRelease-2>
2769 event gen .t.f <Control-Button-2>
2770 event gen .t.f <Control-ButtonRelease-2>
2767 event generate .t.f <Button-2>
2768 event generate .t.f <ButtonRelease-2>
2769 event generate .t.f <Control-Button-2>
2770 event generate .t.f <Control-ButtonRelease-2>
27712771 event delete <<xyz>>
2772 event gen .t.f <Button-2>
2773 event gen .t.f <ButtonRelease-2>
2774 event gen .t.f <Control-Button-2>
2775 event gen .t.f <Control-ButtonRelease-2>
2772 event generate .t.f <Button-2>
2773 event generate .t.f <ButtonRelease-2>
2774 event generate .t.f <Control-Button-2>
2775 event generate .t.f <Control-ButtonRelease-2>
27762776 list $x [event info <<abc>>]
27772777 } -cleanup {
27782778 destroy .t.f
27942794 bind .t.f <<xyz>> {lappend x xyz}
27952795 bind .t.f <<abc>> {lappend x abc}
27962796 bind .t.f <<def>> {lappend x def}
2797 event gen .t.f <Button-2>
2798 event gen .t.f <ButtonRelease-2>
2799 event gen .t.f <Control-Button-2>
2800 event gen .t.f <Control-ButtonRelease-2>
2801 event gen .t.f <Shift-Button-2>
2802 event gen .t.f <Shift-ButtonRelease-2>
2797 event generate .t.f <Button-2>
2798 event generate .t.f <ButtonRelease-2>
2799 event generate .t.f <Control-Button-2>
2800 event generate .t.f <Control-ButtonRelease-2>
2801 event generate .t.f <Shift-Button-2>
2802 event generate .t.f <Shift-ButtonRelease-2>
28032803 event delete <<xyz>>
2804 event gen .t.f <Button-2>
2805 event gen .t.f <Control-Button-2>
2806 event gen .t.f <Shift-Button-2>
2807 event gen .t.f <ButtonRelease-2>
2808 event gen .t.f <Control-ButtonRelease-2>
2809 event gen .t.f <Shift-ButtonRelease-2>
2804 event generate .t.f <Button-2>
2805 event generate .t.f <Control-Button-2>
2806 event generate .t.f <Shift-Button-2>
2807 event generate .t.f <ButtonRelease-2>
2808 event generate .t.f <Control-ButtonRelease-2>
2809 event generate .t.f <Shift-ButtonRelease-2>
28102810 list $x [event info <<def>>] [event info <<xyz>>] [event info <<abc>>]
28112811 } -cleanup {
28122812 destroy .t.f
28292829 bind .t.f <<xyz>> {lappend x xyz}
28302830 bind .t.f <<abc>> {lappend x abc}
28312831 bind .t.f <<def>> {lappend x def}
2832 event gen .t.f <Button-2>
2833 event gen .t.f <ButtonRelease-2>
2834 event gen .t.f <Control-Button-2>
2835 event gen .t.f <Control-ButtonRelease-2>
2836 event gen .t.f <Shift-Button-2>
2837 event gen .t.f <Shift-ButtonRelease-2>
2832 event generate .t.f <Button-2>
2833 event generate .t.f <ButtonRelease-2>
2834 event generate .t.f <Control-Button-2>
2835 event generate .t.f <Control-ButtonRelease-2>
2836 event generate .t.f <Shift-Button-2>
2837 event generate .t.f <Shift-ButtonRelease-2>
28382838 event delete <<xyz>>
2839 event gen .t.f <Button-2>
2840 event gen .t.f <ButtonRelease-2>
2841 event gen .t.f <Control-Button-2>
2842 event gen .t.f <Control-ButtonRelease-2>
2843 event gen .t.f <Shift-Button-2>
2844 event gen .t.f <Shift-ButtonRelease-2>
2839 event generate .t.f <Button-2>
2840 event generate .t.f <ButtonRelease-2>
2841 event generate .t.f <Control-Button-2>
2842 event generate .t.f <Control-ButtonRelease-2>
2843 event generate .t.f <Shift-Button-2>
2844 event generate .t.f <Shift-ButtonRelease-2>
28452845 list $x [event info <<xyz>>] [event info <<abc>>] [event info <<def>>]
28462846 } -cleanup {
28472847 destroy .t.f
28652865 bind .t.f <<xyz>> {lappend x xyz}
28662866 bind .t.g <<abc>> {lappend x abc}
28672867 bind .t.h <<def>> {lappend x def}
2868 event gen .t.f <Button-2>
2869 event gen .t.f <ButtonRelease-2>
2870 event gen .t.g <Button-2>
2871 event gen .t.g <ButtonRelease-2>
2872 event gen .t.h <Button-2>
2873 event gen .t.h <ButtonRelease-2>
2868 event generate .t.f <Button-2>
2869 event generate .t.f <ButtonRelease-2>
2870 event generate .t.g <Button-2>
2871 event generate .t.g <ButtonRelease-2>
2872 event generate .t.h <Button-2>
2873 event generate .t.h <ButtonRelease-2>
28742874 event delete <<xyz>>
2875 event gen .t.f <Button-2>
2876 event gen .t.f <ButtonRelease-2>
2877 event gen .t.g <Button-2>
2878 event gen .t.g <ButtonRelease-2>
2879 event gen .t.h <Button-2>
2880 event gen .t.h <ButtonRelease-2>
2875 event generate .t.f <Button-2>
2876 event generate .t.f <ButtonRelease-2>
2877 event generate .t.g <Button-2>
2878 event generate .t.g <ButtonRelease-2>
2879 event generate .t.h <Button-2>
2880 event generate .t.h <ButtonRelease-2>
28812881 list $x [event info <<xyz>>] [event info <<abc>>] [event info <<def>>]
28822882 } -cleanup {
28832883 destroy .t.f .t.g .t.h
29012901 bind .t.f <<xyz>> {lappend x xyz}
29022902 bind .t.g <<abc>> {lappend x abc}
29032903 bind .t.h <<def>> {lappend x def}
2904 event gen .t.f <Button-2>
2905 event gen .t.f <ButtonRelease-2>
2906 event gen .t.g <Button-2>
2907 event gen .t.g <ButtonRelease-2>
2908 event gen .t.h <Button-2>
2909 event gen .t.h <ButtonRelease-2>
2904 event generate .t.f <Button-2>
2905 event generate .t.f <ButtonRelease-2>
2906 event generate .t.g <Button-2>
2907 event generate .t.g <ButtonRelease-2>
2908 event generate .t.h <Button-2>
2909 event generate .t.h <ButtonRelease-2>
29102910 event delete <<abc>>
2911 event gen .t.f <Button-2>
2912 event gen .t.f <ButtonRelease-2>
2913 event gen .t.g <Button-2>
2914 event gen .t.g <ButtonRelease-2>
2915 event gen .t.h <Button-2>
2916 event gen .t.h <ButtonRelease-2>
2911 event generate .t.f <Button-2>
2912 event generate .t.f <ButtonRelease-2>
2913 event generate .t.g <Button-2>
2914 event generate .t.g <ButtonRelease-2>
2915 event generate .t.h <Button-2>
2916 event generate .t.h <ButtonRelease-2>
29172917 list $x [event info <<xyz>>] [event info <<abc>>] [event info <<def>>]
29182918 } -cleanup {
29192919 destroy .t.f .t.g .t.h
29372937 bind .t.f <<xyz>> {lappend x xyz}
29382938 bind .t.g <<abc>> {lappend x abc}
29392939 bind .t.h <<def>> {lappend x def}
2940 event gen .t.f <Button-2>
2941 event gen .t.f <ButtonRelease-2>
2942 event gen .t.g <Button-2>
2943 event gen .t.g <ButtonRelease-2>
2944 event gen .t.h <Button-2>
2945 event gen .t.h <ButtonRelease-2>
2940 event generate .t.f <Button-2>
2941 event generate .t.f <ButtonRelease-2>
2942 event generate .t.g <Button-2>
2943 event generate .t.g <ButtonRelease-2>
2944 event generate .t.h <Button-2>
2945 event generate .t.h <ButtonRelease-2>
29462946 event delete <<def>>
2947 event gen .t.f <Button-2>
2948 event gen .t.f <ButtonRelease-2>
2949 event gen .t.g <Button-2>
2950 event gen .t.g <ButtonRelease-2>
2951 event gen .t.h <Button-2>
2952 event gen .t.h <ButtonRelease-2>
2947 event generate .t.f <Button-2>
2948 event generate .t.f <ButtonRelease-2>
2949 event generate .t.g <Button-2>
2950 event generate .t.g <ButtonRelease-2>
2951 event generate .t.h <Button-2>
2952 event generate .t.h <ButtonRelease-2>
29532953 list $x [event info <<xyz>>] [event info <<abc>>] [event info <<def>>]
29542954 } -cleanup {
29552955 destroy .t.f .t.g .t.h
30103010 test bind-22.1 {HandleEventGenerate} -setup {
30113011 destroy .xyz
30123012 } -body {
3013 event gen .xyz <Control-v>
3013 event generate .xyz <Control-v>
30143014 } -returnCodes error -result {bad window path name ".xyz"}
30153015 test bind-22.2 {HandleEventGenerate} -body {
3016 event gen zzz <Control-v>
3016 event generate zzz <Control-v>
30173017 } -returnCodes error -result {bad window name/identifier "zzz"}
30183018 test bind-22.3 {HandleEventGenerate} -body {
3019 event gen 47 <Control-v>
3019 event generate 47 <Control-v>
30203020 } -returnCodes error -result {bad window name/identifier "47"}
30213021 test bind-22.4 {HandleEventGenerate} -setup {
30223022 frame .t.f -class Test -width 150 -height 100
30263026 set x {}
30273027 } -body {
30283028 bind .t.f <Button> {set x "%s %b"}
3029 event gen [winfo id .t.f] <Control-Button-1> -state 260
3029 event generate [winfo id .t.f] <Control-Button-1> -state 260
30303030 set x
30313031 } -cleanup {
30323032 destroy .t.f
30333033 } -result {260 1}
30343034 test bind-22.5 {HandleEventGenerate} -body {
3035 event gen . <xyz>
3035 event generate . <xyz>
30363036 } -returnCodes error -result {bad event type or keysym "xyz"}
30373037 test bind-22.6 {HandleEventGenerate} -body {
3038 event gen . <Double-Button-1>
3038 event generate . <Double-Button-1>
30393039 } -returnCodes error -result {Double or Triple modifier not allowed}
30403040 test bind-22.7 {HandleEventGenerate} -body {
3041 event gen . xyz
3041 event generate . xyz
30423042 } -returnCodes error -result {only one event specification allowed}
30433043 test bind-22.8 {HandleEventGenerate} -body {
3044 event gen . <Button> -button
3044 event generate . <Button> -button
30453045 } -returnCodes error -result {value for "-button" missing}
30463046 test bind-22.9 {HandleEventGenerate} -setup {
30473047 frame .t.f -class Test -width 150 -height 100
30513051 set x {}
30523052 } -body {
30533053 bind .t.f <Button> {set x "%s %b"}
3054 event gen .t.f <ButtonRelease-1>
3055 event gen .t.f <ButtonRelease-2>
3056 event gen .t.f <ButtonRelease-3>
3057 event gen .t.f <Control-Button-1>
3058 event gen .t.f <Control-ButtonRelease-1>
3054 event generate .t.f <ButtonRelease-1>
3055 event generate .t.f <ButtonRelease-2>
3056 event generate .t.f <ButtonRelease-3>
3057 event generate .t.f <Control-Button-1>
3058 event generate .t.f <Control-ButtonRelease-1>
30593059 set x
30603060 } -cleanup {
30613061 destroy .t.f
30683068 set x {}
30693069 } -body {
30703070 bind .t.f <Key> {set x "%s %K"}
3071 event gen .t.f <Control-Key-1>
3072 set x
3073 } -cleanup {
3074 destroy .t.f
3075 } -result {4 1}
3071 event generate .t.f <Control-Key-space>
3072 set x
3073 } -cleanup {
3074 destroy .t.f
3075 } -result {4 space}
30763076 test bind-22.11 {HandleEventGenerate} -setup {
30773077 frame .t.f -class Test -width 150 -height 100
30783078 pack .t.f
30813081 set x {}
30823082 } -body {
30833083 bind .t.f <<Paste>> {set x "%s"}
3084 event gen .t.f <<Paste>> -state 1
3084 event generate .t.f <<Paste>> -state 1
30853085 set x
30863086 } -cleanup {
30873087 destroy .t.f
30943094 set x {}
30953095 } -body {
30963096 bind .t.f <Motion> {set x "%s"}
3097 event gen .t.f <Control-Motion>
3097 event generate .t.f <Control-Motion>
30983098 set x
30993099 } -cleanup {
31003100 destroy .t.f
31073107 set x {}
31083108 } -body {
31093109 bind .t.f <Button> {lappend x %#}
3110 event gen .t.f <Button> -when now -serial 100
3111 event gen .t.f <ButtonRelease> -when now
3110 event generate .t.f <Button> -when now -serial 100
3111 event generate .t.f <ButtonRelease> -when now
31123112 set x
31133113 } -cleanup {
31143114 destroy .t.f
31213121 set x {}
31223122 } -body {
31233123 bind .t.f <Button> {lappend x %#}
3124 event gen .t.f <Button> -when head -serial 100
3125 event gen .t.f <Button> -when head -serial 101
3126 event gen .t.f <Button> -when head -serial 102
3127 event gen .t.f <ButtonRelease> -when tail
3124 event generate .t.f <Button> -when head -serial 100
3125 event generate .t.f <Button> -when head -serial 101
3126 event generate .t.f <Button> -when head -serial 102
3127 event generate .t.f <ButtonRelease> -when tail
31283128 lappend x foo
31293129 update
31303130 set x
31393139 set x {}
31403140 } -body {
31413141 bind .t.f <Button> {lappend x %#}
3142 event gen .t.f <Button> -when head -serial 99
3143 event gen .t.f <Button> -when mark -serial 100
3144 event gen .t.f <Button> -when mark -serial 101
3145 event gen .t.f <Button> -when mark -serial 102
3146 event gen .t.f <ButtonRelease> -when tail
3142 event generate .t.f <Button> -when head -serial 99
3143 event generate .t.f <Button> -when mark -serial 100
3144 event generate .t.f <Button> -when mark -serial 101
3145 event generate .t.f <Button> -when mark -serial 102
3146 event generate .t.f <ButtonRelease> -when tail
31473147 lappend x foo
31483148 update
31493149 set x
31583158 set x {}
31593159 } -body {
31603160 bind .t.f <Button> {lappend x %#}
3161 event gen .t.f <Button> -when head -serial 99
3162 event gen .t.f <Button> -when tail -serial 100
3163 event gen .t.f <Button> -when tail -serial 101
3164 event gen .t.f <Button> -when tail -serial 102
3165 event gen .t.f <ButtonRelease> -when tail
3161 event generate .t.f <Button> -when head -serial 99
3162 event generate .t.f <Button> -when tail -serial 100
3163 event generate .t.f <Button> -when tail -serial 101
3164 event generate .t.f <Button> -when tail -serial 102
3165 event generate .t.f <ButtonRelease> -when tail
31663166 lappend x foo
31673167 update
31683168 set x
31703170 destroy .t.f
31713171 } -result {foo 99 100 101 102}
31723172 test bind-22.17 {HandleEventGenerate} -body {
3173 event gen . <Button> -when xyz
3173 event generate . <Button> -when xyz
31743174 } -returnCodes error -result {bad -when value "xyz": must be now, head, mark, or tail}
31753175 test bind-22.18 {HandleEventGenerate} -body {
31763176 # Bug 411307
3177 event gen . <a> -root 98765
3177 event generate . <a> -root 98765
31783178 } -returnCodes error -result {bad window name/identifier "98765"}
31793179
31803180 test bind-22.19 {HandleEventGenerate: options <Configure> -above .xyz} -setup {
31853185 set x {}
31863186 } -body {
31873187 bind .t.f <Configure> "lappend x %a"
3188 event gen .t.f <Configure> -above .xyz
3188 event generate .t.f <Configure> -above .xyz
31893189 } -cleanup {
31903190 destroy .t.f
31913191 } -returnCodes error -result {bad window path name ".xyz"}
31973197 set x {}
31983198 } -body {
31993199 bind .t.f <Configure> "lappend x %a"
3200 event gen .t.f <Configure> -above .t
3200 event generate .t.f <Configure> -above .t
32013201 return $x
32023202 } -cleanup {
32033203 destroy .t.f
32103210 set x {}
32113211 } -body {
32123212 bind .t.f <Configure> "lappend x %a"
3213 event gen .t.f <Configure> -above xyz
3213 event generate .t.f <Configure> -above xyz
32143214 } -cleanup {
32153215 destroy .t.f
32163216 } -returnCodes error -result {bad window name/identifier "xyz"}
32223222 set x {}
32233223 } -body {
32243224 bind .t.f <Configure> "lappend x %a"
3225 event gen .t.f <Configure> -above [winfo id .t]
3225 event generate .t.f <Configure> -above [winfo id .t]
32263226 return $x
32273227 } -cleanup {
32283228 destroy .t.f
32363236 set x {}
32373237 } -body {
32383238 bind .t.f <Key> "lappend x %b"
3239 event gen .t.f <Key> -above .
3239 event generate .t.f <Key> -above .
32403240 return $x
32413241 } -cleanup {
32423242 destroy .t.f
32503250 set x {}
32513251 } -body {
32523252 bind .t.f <Configure> "lappend x %B"
3253 event gen .t.f <Configure> -borderwidth xyz
3253 event generate .t.f <Configure> -borderwidth xyz
32543254 return $x
32553255 } -cleanup {
32563256 destroy .t.f
32643264 set x {}
32653265 } -body {
32663266 bind .t.f <Configure> "lappend x %B"
3267 event gen .t.f <Configure> -borderwidth 2i
3267 event generate .t.f <Configure> -borderwidth 2i
32683268 expr {[winfo pixels .t.f 2i] eq $x}
32693269 } -cleanup {
32703270 destroy .t.f
32783278 set x {}
32793279 } -body {
32803280 bind .t.f <Key> "lappend x %k"
3281 event gen .t.f <Key> -borderwidth 2i
3281 event generate .t.f <Key> -borderwidth 2i
32823282 } -cleanup {
32833283 destroy .t.f
32843284 } -returnCodes error -result {<Key> event doesn't accept "-borderwidth" option}
32913291 set x {}
32923292 } -body {
32933293 bind .t.f <Button> "lappend x %b"
3294 event gen .t.f <Button> -button xyz
3294 event generate .t.f <Button> -button xyz
32953295 } -cleanup {
32963296 destroy .t.f
32973297 } -returnCodes error -result {expected integer but got "xyz"}
33043304 set x {}
33053305 } -body {
33063306 bind .t.f <Button> "lappend x %b"
3307 event gen .t.f <Button> -button 1
3307 event generate .t.f <Button> -button 1
33083308 return $x
33093309 } -cleanup {
33103310 destroy .t.f
33183318 set x {}
33193319 } -body {
33203320 bind .t.f <ButtonRelease> "lappend x %b"
3321 event gen .t.f <ButtonRelease> -button 1
3321 event generate .t.f <ButtonRelease> -button 1
33223322 return $x
33233323 } -cleanup {
33243324 destroy .t.f
33323332 set x {}
33333333 } -body {
33343334 bind .t.f <Key> "lappend x %k"
3335 event gen .t.f <Key> -button 1
3335 event generate .t.f <Key> -button 1
33363336 } -cleanup {
33373337 destroy .t.f
33383338 } -returnCodes error -result {<Key> event doesn't accept "-button" option}
33453345 set x {}
33463346 } -body {
33473347 bind .t.f <Expose> "lappend x %c"
3348 event gen .t.f <Expose> -count xyz
3348 event generate .t.f <Expose> -count xyz
33493349 } -cleanup {
33503350 destroy .t.f
33513351 } -returnCodes error -result {expected integer but got "xyz"}
33583358 set x {}
33593359 } -body {
33603360 bind .t.f <Expose> "lappend x %c"
3361 event gen .t.f <Expose> -count 20
3361 event generate .t.f <Expose> -count 20
33623362 return $x
33633363 } -cleanup {
33643364 destroy .t.f
33723372 set x {}
33733373 } -body {
33743374 bind .t.f <Key> "lappend x %b"
3375 event gen .t.f <Key> -count 20
3375 event generate .t.f <Key> -count 20
33763376 } -cleanup {
33773377 destroy .t.f
33783378 } -returnCodes error -result {<Key> event doesn't accept "-count" option}
33853385 set x {}
33863386 } -body {
33873387 bind .t.f <Enter> "lappend x %d"
3388 event gen .t.f <Enter> -detail xyz
3388 event generate .t.f <Enter> -detail xyz
33893389 } -cleanup {
33903390 destroy .t.f
33913391 } -returnCodes error -result {bad -detail value "xyz": must be NotifyAncestor, NotifyVirtual, NotifyInferior, NotifyNonlinear, NotifyNonlinearVirtual, NotifyPointer, NotifyPointerRoot, or NotifyDetailNone}
33973397 update
33983398 set x {}
33993399 } -body {
3400 bind .t.f <FocusIn> "lappend x %d"
3401 event gen .t.f <FocusIn> -detail NotifyVirtual
3402 return $x
3403 } -cleanup {
3404 destroy .t.f
3405 } -result {}
3400 bind .t.f <FocusIn> "lappend x FocusIn %d"
3401 event generate .t.f <FocusIn> -detail NotifyVirtual
3402 return $x
3403 } -cleanup {
3404 destroy .t.f
3405 } -result {FocusIn NotifyVirtual}
3406
3407 test bind-22.35.1 {HandleEventGenerate: options <FocusOut> -detail NotifyVirtual} -setup {
3408 frame .t.f -class Test -width 150 -height 100
3409 pack .t.f
3410 focus -force .t.f
3411 update
3412 set x {}
3413 } -body {
3414 bind .t.f <FocusOut> "lappend x FocusOut %d"
3415 event generate .t.f <FocusOut> -detail NotifyVirtual
3416 return $x
3417 } -cleanup {
3418 destroy .t.f
3419 } -result {FocusOut NotifyVirtual}
34063420
34073421 test bind-22.36 {HandleEventGenerate: options <Enter> -detail NotifyVirtual} -setup {
34083422 frame .t.f -class Test -width 150 -height 100
34123426 set x {}
34133427 } -body {
34143428 bind .t.f <Enter> "lappend x %d"
3415 event gen .t.f <Enter> -detail NotifyVirtual
3429 event generate .t.f <Enter> -detail NotifyVirtual
34163430 return $x
34173431 } -cleanup {
34183432 destroy .t.f
34263440 set x {}
34273441 } -body {
34283442 bind .t.f <Key> "lappend x %k"
3429 event gen .t.f <Key> -detail NotifyVirtual
3443 event generate .t.f <Key> -detail NotifyVirtual
34303444 } -cleanup {
34313445 destroy .t.f
34323446 } -returnCodes error -result {<Key> event doesn't accept "-detail" option}
34393453 set x {}
34403454 } -body {
34413455 bind .t.f <Enter> "lappend x %f"
3442 event gen .t.f <Enter> -focus xyz
3456 event generate .t.f <Enter> -focus xyz
34433457 } -cleanup {
34443458 destroy .t.f
34453459 } -returnCodes error -result {expected boolean value but got "xyz"}
34523466 set x {}
34533467 } -body {
34543468 bind .t.f <Enter> "lappend x %f"
3455 event gen .t.f <Enter> -focus 1
3469 event generate .t.f <Enter> -focus 1
34563470 return $x
34573471 } -cleanup {
34583472 destroy .t.f
34663480 set x {}
34673481 } -body {
34683482 bind .t.f <Key> "lappend x %k"
3469 event gen .t.f <Key> -focus 1
3483 event generate .t.f <Key> -focus 1
34703484 } -cleanup {
34713485 destroy .t.f
34723486 } -returnCodes error -result {<Key> event doesn't accept "-focus" option}
34793493 set x {}
34803494 } -body {
34813495 bind .t.f <Expose> "lappend x %h"
3482 event gen .t.f <Expose> -height xyz
3496 event generate .t.f <Expose> -height xyz
34833497 } -cleanup {
34843498 destroy .t.f
34853499 } -returnCodes error -result {bad screen distance "xyz"}
34923506 set x {}
34933507 } -body {
34943508 bind .t.f <Expose> "lappend x %h"
3495 event gen .t.f <Expose> -height 2i
3509 event generate .t.f <Expose> -height 2i
34963510 expr {$x eq [winfo pixels .t.f 2i]}
34973511 } -cleanup {
34983512 destroy .t.f
35063520 set x {}
35073521 } -body {
35083522 bind .t.f <Configure> "lappend x %h"
3509 event gen .t.f <Configure> -height 2i
3523 event generate .t.f <Configure> -height 2i
35103524 expr {$x eq [winfo pixels .t.f 2i]}
35113525 } -cleanup {
35123526 destroy .t.f
35203534 set x {}
35213535 } -body {
35223536 bind .t.f <Key> "lappend x %k"
3523 event gen .t.f <Key> -height 2i
3537 event generate .t.f <Key> -height 2i
35243538 } -cleanup {
35253539 destroy .t.f
35263540 } -returnCodes error -result {<Key> event doesn't accept "-height" option}
35333547 set x {}
35343548 } -body {
35353549 bind .t.f <Key> "lappend x %k"
3536 event gen .t.f <Key> -keycode xyz
3550 event generate .t.f <Key> -keycode xyz
35373551 } -cleanup {
35383552 destroy .t.f
35393553 } -returnCodes error -result {expected integer but got "xyz"}
35463560 set x {}
35473561 } -body {
35483562 bind .t.f <Key> "lappend x %k"
3549 event gen .t.f <Key> -keycode 20
3563 event generate .t.f <Key> -keycode 20
35503564 return $x
35513565 } -cleanup {
35523566 destroy .t.f
35603574 set x {}
35613575 } -body {
35623576 bind .t.f <Button> "lappend x %b"
3563 event gen .t.f <Button> -keycode 20
3577 event generate .t.f <Button> -keycode 20
35643578 } -cleanup {
35653579 destroy .t.f
35663580 } -returnCodes error -result {<Button> event doesn't accept "-keycode" option}
35733587 set x {}
35743588 } -body {
35753589 bind .t.f <Key> "lappend x %K"
3576 event gen .t.f <Key> -keysym xyz
3590 event generate .t.f <Key> -keysym xyz
35773591 } -cleanup {
35783592 destroy .t.f
35793593 } -returnCodes error -result {unknown keysym "xyz"}
35803594
3581 test bind-22.49 {HandleEventGenerate: options <Key> -keysym a} -setup {
3595 test bind-22.49 {HandleEventGenerate: options <Key> -keysym space} -setup {
35823596 frame .t.f -class Test -width 150 -height 100
35833597 pack .t.f
35843598 focus -force .t.f
35863600 set x {}
35873601 } -body {
35883602 bind .t.f <Key> "lappend x %K"
3589 event gen .t.f <Key> -keysym a
3590 return $x
3591 } -cleanup {
3592 destroy .t.f
3593 } -result {a}
3594
3595 test bind-22.50 {HandleEventGenerate: options <Button> -keysym a} -setup {
3603 event generate .t.f <Key> -keysym space
3604 return $x
3605 } -cleanup {
3606 destroy .t.f
3607 } -result {space}
3608
3609 test bind-22.50 {HandleEventGenerate: options <Button> -keysym space} -setup {
35963610 frame .t.f -class Test -width 150 -height 100
35973611 pack .t.f
35983612 focus -force .t.f
36003614 set x {}
36013615 } -body {
36023616 bind .t.f <Button> "lappend x %b"
3603 event gen .t.f <Button> -keysym a
3617 event generate .t.f <Button> -keysym space
36043618 } -cleanup {
36053619 destroy .t.f
36063620 } -returnCodes error -result {<Button> event doesn't accept "-keysym" option}
36133627 set x {}
36143628 } -body {
36153629 bind .t.f <Enter> "lappend x %m"
3616 event gen .t.f <Enter> -mode xyz
3630 event generate .t.f <Enter> -mode xyz
36173631 } -cleanup {
36183632 destroy .t.f
36193633 } -returnCodes error -result {bad -mode value "xyz": must be NotifyNormal, NotifyGrab, NotifyUngrab, or NotifyWhileGrabbed}
36263640 set x {}
36273641 } -body {
36283642 bind .t.f <Enter> "lappend x %m"
3629 event gen .t.f <Enter> -mode NotifyNormal
3643 event generate .t.f <Enter> -mode NotifyNormal
36303644 return $x
36313645 } -cleanup {
36323646 destroy .t.f
36403654 set x {}
36413655 } -body {
36423656 bind .t.f <FocusIn> "lappend x %m"
3643 event gen .t.f <FocusIn> -mode NotifyNormal
3644 return $x
3645 } -cleanup {
3646 destroy .t.f
3647 } -result {}
3657 event generate .t.f <FocusIn> -mode NotifyNormal
3658 return $x
3659 } -cleanup {
3660 destroy .t.f
3661 } -result {NotifyNormal}
36483662
36493663 test bind-22.54 {HandleEventGenerate: options <Key> -mode NotifyNormal} -setup {
36503664 frame .t.f -class Test -width 150 -height 100
36543668 set x {}
36553669 } -body {
36563670 bind .t.f <Key> "lappend x %k"
3657 event gen .t.f <Key> -mode NotifyNormal
3671 event generate .t.f <Key> -mode NotifyNormal
36583672 } -cleanup {
36593673 destroy .t.f
36603674 } -returnCodes error -result {<Key> event doesn't accept "-mode" option}
36663680 set x {}
36673681 } -body {
36683682 bind .t.f <Map> "lappend x %o"
3669 event gen .t.f <Map> -override xyz
3683 event generate .t.f <Map> -override xyz
36703684 } -cleanup {
36713685 destroy .t.f
36723686 } -returnCodes error -result {expected boolean value but got "xyz"}
36793693 set x {}
36803694 } -body {
36813695 bind .t.f <Map> "lappend x %o"
3682 event gen .t.f <Map> -override 1
3696 event generate .t.f <Map> -override 1
36833697 return $x
36843698 } -cleanup {
36853699 destroy .t.f
36933707 set x {}
36943708 } -body {
36953709 bind .t.f <Reparent> "lappend x %o"
3696 event gen .t.f <Reparent> -override 1
3710 event generate .t.f <Reparent> -override 1
36973711 return $x
36983712 } -cleanup {
36993713 destroy .t.f
37073721 set x {}
37083722 } -body {
37093723 bind .t.f <Configure> "lappend x %o"
3710 event gen .t.f <Configure> -override 1
3724 event generate .t.f <Configure> -override 1
37113725 return $x
37123726 } -cleanup {
37133727 destroy .t.f
37213735 set x {}
37223736 } -body {
37233737 bind .t.f <Key> "lappend x %k"
3724 event gen .t.f <Key> -override 1
3738 event generate .t.f <Key> -override 1
37253739 } -cleanup {
37263740 destroy .t.f
37273741 } -returnCodes error -result {<Key> event doesn't accept "-override" option}
37343748 set x {}
37353749 } -body {
37363750 bind .t.f <Circulate> "lappend x %p"
3737 event gen .t.f <Circulate> -place xyz
3751 event generate .t.f <Circulate> -place xyz
37383752 } -cleanup {
37393753 destroy .t.f
37403754 } -returnCodes error -result {bad -place value "xyz": must be PlaceOnTop, or PlaceOnBottom}
37473761 set x {}
37483762 } -body {
37493763 bind .t.f <Circulate> "lappend x %p"
3750 event gen .t.f <Circulate> -place PlaceOnTop
3764 event generate .t.f <Circulate> -place PlaceOnTop
37513765 return $x
37523766 } -cleanup {
37533767 destroy .t.f
37613775 set x {}
37623776 } -body {
37633777 bind .t.f <Key> "lappend x %k"
3764 event gen .t.f <Key> -place PlaceOnTop
3778 event generate .t.f <Key> -place PlaceOnTop
37653779 } -cleanup {
37663780 destroy .t.f
37673781 } -returnCodes error -result {<Key> event doesn't accept "-place" option}
37743788 set x {}
37753789 } -body {
37763790 bind .t.f <Key> "lappend x %R"
3777 event gen .t.f <Key> -root .xyz
3791 event generate .t.f <Key> -root .xyz
37783792 } -cleanup {
37793793 destroy .t.f
37803794 } -returnCodes error -result {bad window path name ".xyz"}
37873801 set x {}
37883802 } -body {
37893803 bind .t.f <Key> "lappend x %R"
3790 event gen .t.f <Key> -root .t
3804 event generate .t.f <Key> -root .t
37913805 expr {[winfo id .t] eq $x}
37923806 } -cleanup {
37933807 destroy .t.f
38013815 set x {}
38023816 } -body {
38033817 bind .t.f <Key> "lappend x %R"
3804 event gen .t.f <Key> -root xyz
3818 event generate .t.f <Key> -root xyz
38053819 } -cleanup {
38063820 destroy .t.f
38073821 } -returnCodes error -result {bad window name/identifier "xyz"}
38143828 set x {}
38153829 } -body {
38163830 bind .t.f <Key> "lappend x %R"
3817 event gen .t.f <Key> -root [winfo id .t]
3831 event generate .t.f <Key> -root [winfo id .t]
38183832 expr {[winfo id .t] eq $x}
38193833 } -cleanup {
38203834 destroy .t.f
38283842 set x {}
38293843 } -body {
38303844 bind .t.f <Button> "lappend x %R"
3831 event gen .t.f <Button> -root .t
3845 event generate .t.f <Button> -root .t
38323846 expr {[winfo id .t] eq $x}
38333847 } -cleanup {
38343848 destroy .t.f
38423856 set x {}
38433857 } -body {
38443858 bind .t.f <ButtonRelease> "lappend x %R"
3845 event gen .t.f <ButtonRelease> -root .t
3859 event generate .t.f <ButtonRelease> -root .t
38463860 expr {[winfo id .t] eq $x}
38473861 } -cleanup {
38483862 destroy .t.f
38563870 set x {}
38573871 } -body {
38583872 bind .t.f <Motion> "lappend x %R"
3859 event gen .t.f <Motion> -root .t
3873 event generate .t.f <Motion> -root .t
38603874 expr {[winfo id .t] eq $x}
38613875 } -cleanup {
38623876 destroy .t.f
38703884 set x {}
38713885 } -body {
38723886 bind .t.f <<Paste>> "lappend x %R"
3873 event gen .t.f <<Paste>> -root .t
3887 event generate .t.f <<Paste>> -root .t
38743888 expr {[winfo id .t] eq $x}
38753889 } -cleanup {
38763890 destroy .t.f
38843898 set x {}
38853899 } -body {
38863900 bind .t.f <Enter> "lappend x %R"
3887 event gen .t.f <Enter> -root .t
3901 event generate .t.f <Enter> -root .t
38883902 expr {[winfo id .t] eq $x}
38893903 } -cleanup {
38903904 destroy .t.f
38983912 set x {}
38993913 } -body {
39003914 bind .t.f <Configure> "lappend x %R"
3901 event gen .t.f <Configure> -root .t
3915 event generate .t.f <Configure> -root .t
39023916 } -cleanup {
39033917 destroy .t.f
39043918 } -returnCodes error -result {<Configure> event doesn't accept "-root" option}
39113925 set x {}
39123926 } -body {
39133927 bind .t.f <Key> "lappend x %X"
3914 event gen .t.f <Key> -rootx xyz
3928 event generate .t.f <Key> -rootx xyz
39153929 } -cleanup {
39163930 destroy .t.f
39173931 } -returnCodes error -result {bad screen distance "xyz"}
39243938 set x {}
39253939 } -body {
39263940 bind .t.f <Key> "lappend x %X"
3927 event gen .t.f <Key> -rootx 2i
3941 event generate .t.f <Key> -rootx 2i
39283942 expr {[winfo pixels .t.f 2i] eq $x}
39293943 } -cleanup {
39303944 destroy .t.f
39383952 set x {}
39393953 } -body {
39403954 bind .t.f <Button> "lappend x %X"
3941 event gen .t.f <Button> -rootx 2i
3955 event generate .t.f <Button> -rootx 2i
39423956 expr {[winfo pixels .t.f 2i] eq $x}
39433957 } -cleanup {
39443958 destroy .t.f
39523966 set x {}
39533967 } -body {
39543968 bind .t.f <ButtonRelease> "lappend x %X"
3955 event gen .t.f <ButtonRelease> -rootx 2i
3969 event generate .t.f <ButtonRelease> -rootx 2i
39563970 expr {[winfo pixels .t.f 2i] eq $x}
39573971 } -cleanup {
39583972 destroy .t.f
39663980 set x {}
39673981 } -body {
39683982 bind .t.f <Motion> "lappend x %X"
3969 event gen .t.f <Motion> -rootx 2i
3983 event generate .t.f <Motion> -rootx 2i
39703984 expr {[winfo pixels .t.f 2i] eq $x}
39713985 } -cleanup {
39723986 destroy .t.f
39803994 set x {}
39813995 } -body {
39823996 bind .t.f <<Paste>> "lappend x %X"
3983 event gen .t.f <<Paste>> -rootx 2i
3997 event generate .t.f <<Paste>> -rootx 2i
39843998 expr {[winfo pixels .t.f 2i] eq $x}
39853999 } -cleanup {
39864000 destroy .t.f
39944008 set x {}
39954009 } -body {
39964010 bind .t.f <Enter> "lappend x %X"
3997 event gen .t.f <Enter> -rootx 2i
4011 event generate .t.f <Enter> -rootx 2i
39984012 expr {[winfo pixels .t.f 2i] eq $x}
39994013 } -cleanup {
40004014 destroy .t.f
40084022 set x {}
40094023 } -body {
40104024 bind .t.f <Configure> "lappend x %X"
4011 event gen .t.f <Configure> -rootx 2i
4025 event generate .t.f <Configure> -rootx 2i
40124026 } -cleanup {
40134027 destroy .t.f
40144028 } -returnCodes error -result {<Configure> event doesn't accept "-rootx" option}
40214035 set x {}
40224036 } -body {
40234037 bind .t.f <Key> "lappend x %Y"
4024 event gen .t.f <Key> -rooty xyz
4038 event generate .t.f <Key> -rooty xyz
40254039 } -cleanup {
40264040 destroy .t.f
40274041 } -returnCodes error -result {bad screen distance "xyz"}
40344048 set x {}
40354049 } -body {
40364050 bind .t.f <Key> "lappend x %Y"
4037 event gen .t.f <Key> -rooty 2i
4051 event generate .t.f <Key> -rooty 2i
40384052 expr {[winfo pixels .t.f 2i] eq $x}
40394053 } -cleanup {
40404054 destroy .t.f
40484062 set x {}
40494063 } -body {
40504064 bind .t.f <Button> "lappend x %Y"
4051 event gen .t.f <Button> -rooty 2i
4065 event generate .t.f <Button> -rooty 2i
40524066 expr {[winfo pixels .t.f 2i] eq $x}
40534067 } -cleanup {
40544068 destroy .t.f
40624076 set x {}
40634077 } -body {
40644078 bind .t.f <ButtonRelease> "lappend x %Y"
4065 event gen .t.f <ButtonRelease> -rooty 2i
4079 event generate .t.f <ButtonRelease> -rooty 2i
40664080 expr {[winfo pixels .t.f 2i] eq $x}
40674081 } -cleanup {
40684082 destroy .t.f
40764090 set x {}
40774091 } -body {
40784092 bind .t.f <Motion> "lappend x %Y"
4079 event gen .t.f <Motion> -rooty 2i
4093 event generate .t.f <Motion> -rooty 2i
40804094 expr {[winfo pixels .t.f 2i] eq $x}
40814095 } -cleanup {
40824096 destroy .t.f
40904104 set x {}
40914105 } -body {
40924106 bind .t.f <<Paste>> "lappend x %Y"
4093 event gen .t.f <<Paste>> -rooty 2i
4107 event generate .t.f <<Paste>> -rooty 2i
40944108 expr {[winfo pixels .t.f 2i] eq $x}
40954109 } -cleanup {
40964110 destroy .t.f
41044118 set x {}
41054119 } -body {
41064120 bind .t.f <Enter> "lappend x %Y"
4107 event gen .t.f <Enter> -rooty 2i
4121 event generate .t.f <Enter> -rooty 2i
41084122 expr {[winfo pixels .t.f 2i] eq $x}
41094123 } -cleanup {
41104124 destroy .t.f
41184132 set x {}
41194133 } -body {
41204134 bind .t.f <Configure> "lappend x %Y"
4121 event gen .t.f <Configure> -rooty 2i
4135 event generate .t.f <Configure> -rooty 2i
41224136 } -cleanup {
41234137 destroy .t.f
41244138 } -returnCodes error -result {<Configure> event doesn't accept "-rooty" option}
41314145 set x {}
41324146 } -body {
41334147 bind .t.f <Key> "lappend x %E"
4134 event gen .t.f <Key> -sendevent xyz
4148 event generate .t.f <Key> -sendevent xyz
41354149 } -cleanup {
41364150 destroy .t.f
41374151 } -returnCodes error -result {expected boolean value but got "xyz"}
41444158 set x {}
41454159 } -body {
41464160 bind .t.f <Key> "lappend x %E"
4147 event gen .t.f <Key> -sendevent 1
4161 event generate .t.f <Key> -sendevent 1
41484162 return $x
41494163 } -cleanup {
41504164 destroy .t.f
41584172 set x {}
41594173 } -body {
41604174 bind .t.f <Key> "lappend x %E"
4161 event gen .t.f <Key> -sendevent yes
4175 event generate .t.f <Key> -sendevent yes
41624176 return $x
41634177 } -cleanup {
41644178 destroy .t.f
41724186 set x {}
41734187 } -body {
41744188 bind .t.f <Key> "lappend x %E"
4175 event gen .t.f <Key> -sendevent 43
4189 event generate .t.f <Key> -sendevent 43
41764190 return $x
41774191 } -cleanup {
41784192 destroy .t.f
41864200 set x {}
41874201 } -body {
41884202 bind .t.f <Key> "lappend x %#"
4189 event gen .t.f <Key> -serial xyz
4203 event generate .t.f <Key> -serial xyz
41904204 } -cleanup {
41914205 destroy .t.f
41924206 } -returnCodes error -result {expected integer but got "xyz"}
41994213 set x {}
42004214 } -body {
42014215 bind .t.f <Key> "lappend x %#"
4202 event gen .t.f <Key> -serial 100
4216 event generate .t.f <Key> -serial 100
42034217 return $x
42044218 } -cleanup {
42054219 destroy .t.f
42134227 set x {}
42144228 } -body {
42154229 bind .t.f <Key> "lappend x %s"
4216 event gen .t.f <Key> -state xyz
4230 event generate .t.f <Key> -state xyz
42174231 } -cleanup {
42184232 destroy .t.f
42194233 } -returnCodes error -result {expected integer but got "xyz"}
42264240 set x {}
42274241 } -body {
42284242 bind .t.f <Key> "lappend x %s"
4229 event gen .t.f <Key> -state 1
4243 event generate .t.f <Key> -state 1
42304244 return $x
42314245 } -cleanup {
42324246 destroy .t.f
42404254 set x {}
42414255 } -body {
42424256 bind .t.f <Button> "lappend x %s"
4243 event gen .t.f <Button> -state 1025
4257 event generate .t.f <Button> -state 1025
42444258 return $x
42454259 } -cleanup {
42464260 destroy .t.f
42544268 set x {}
42554269 } -body {
42564270 bind .t.f <ButtonRelease> "lappend x %s"
4257 event gen .t.f <ButtonRelease> -state 1025
4271 event generate .t.f <ButtonRelease> -state 1025
42584272 return $x
42594273 } -cleanup {
42604274 destroy .t.f
42684282 set x {}
42694283 } -body {
42704284 bind .t.f <Motion> "lappend x %s"
4271 event gen .t.f <Motion> -state 1
4285 event generate .t.f <Motion> -state 1
42724286 return $x
42734287 } -cleanup {
42744288 destroy .t.f
42824296 set x {}
42834297 } -body {
42844298 bind .t.f <<Paste>> "lappend x %s"
4285 event gen .t.f <<Paste>> -state 1
4299 event generate .t.f <<Paste>> -state 1
42864300 return $x
42874301 } -cleanup {
42884302 destroy .t.f
42964310 set x {}
42974311 } -body {
42984312 bind .t.f <Enter> "lappend x %s"
4299 event gen .t.f <Enter> -state 1
4313 event generate .t.f <Enter> -state 1
43004314 return $x
43014315 } -cleanup {
43024316 destroy .t.f
43104324 set x {}
43114325 } -body {
43124326 bind .t.f <Visibility> "lappend x %s"
4313 event gen .t.f <Visibility> -state xyz
4327 event generate .t.f <Visibility> -state xyz
43144328 } -cleanup {
43154329 destroy .t.f
43164330 } -returnCodes error -result {bad -state value "xyz": must be VisibilityUnobscured, VisibilityPartiallyObscured, or VisibilityFullyObscured}
43234337 set x {}
43244338 } -body {
43254339 bind .t.f <Visibility> "lappend x %s"
4326 event gen .t.f <Visibility> -state VisibilityUnobscured
4340 event generate .t.f <Visibility> -state VisibilityUnobscured
43274341 return $x
43284342 } -cleanup {
43294343 destroy .t.f
43374351 set x {}
43384352 } -body {
43394353 bind .t.f <Configure> "lappend x %s"
4340 event gen .t.f <Configure> -state xyz
4354 event generate .t.f <Configure> -state xyz
43414355 } -cleanup {
43424356 destroy .t.f
43434357 } -returnCodes error -result {<Configure> event doesn't accept "-state" option}
43504364 set x {}
43514365 } -body {
43524366 bind .t.f <Key> "lappend x %S"
4353 event gen .t.f <Key> -subwindow .xyz
4367 event generate .t.f <Key> -subwindow .xyz
43544368 } -cleanup {
43554369 destroy .t.f
43564370 } -returnCodes error -result {bad window path name ".xyz"}
43634377 set x {}
43644378 } -body {
43654379 bind .t.f <Key> "lappend x %S"
4366 event gen .t.f <Key> -subwindow .t
4380 event generate .t.f <Key> -subwindow .t
43674381 expr {[winfo id .t] eq $x}
43684382 } -cleanup {
43694383 destroy .t.f
43774391 set x {}
43784392 } -body {
43794393 bind .t.f <Key> "lappend x %S"
4380 event gen .t.f <Key> -subwindow xyz
4394 event generate .t.f <Key> -subwindow xyz
43814395 } -cleanup {
43824396 destroy .t.f
43834397 } -returnCodes error -result {bad window name/identifier "xyz"}
43904404 set x {}
43914405 } -body {
43924406 bind .t.f <Key> "lappend x %S"
4393 event gen .t.f <Key> -subwindow [winfo id .t]
4407 event generate .t.f <Key> -subwindow [winfo id .t]
43944408 expr {[winfo id .t] eq $x}
43954409 } -cleanup {
43964410 destroy .t.f
44044418 set x {}
44054419 } -body {
44064420 bind .t.f <Button> "lappend x %S"
4407 event gen .t.f <Button> -subwindow .t
4421 event generate .t.f <Button> -subwindow .t
44084422 expr {[winfo id .t] eq $x}
44094423 } -cleanup {
44104424 destroy .t.f
44184432 set x {}
44194433 } -body {
44204434 bind .t.f <ButtonRelease> "lappend x %S"
4421 event gen .t.f <ButtonRelease> -subwindow .t
4435 event generate .t.f <ButtonRelease> -subwindow .t
44224436 expr {[winfo id .t] eq $x}
44234437 } -cleanup {
44244438 destroy .t.f
44324446 set x {}
44334447 } -body {
44344448 bind .t.f <Motion> "lappend x %S"
4435 event gen .t.f <Motion> -subwindow .t
4449 event generate .t.f <Motion> -subwindow .t
44364450 expr {[winfo id .t] eq $x}
44374451 } -cleanup {
44384452 destroy .t.f
44464460 set x {}
44474461 } -body {
44484462 bind .t.f <<Paste>> "lappend x %S"
4449 event gen .t.f <<Paste>> -subwindow .t
4463 event generate .t.f <<Paste>> -subwindow .t
44504464 expr {[winfo id .t] eq $x}
44514465 } -cleanup {
44524466 destroy .t.f
44604474 set x {}
44614475 } -body {
44624476 bind .t.f <Enter> "lappend x %S"
4463 event gen .t.f <Enter> -subwindow .t
4477 event generate .t.f <Enter> -subwindow .t
44644478 expr {[winfo id .t] eq $x}
44654479 } -cleanup {
44664480 destroy .t.f
44744488 set x {}
44754489 } -body {
44764490 bind .t.f <Configure> "lappend x %S"
4477 event gen .t.f <Configure> -subwindow .t
4491 event generate .t.f <Configure> -subwindow .t
44784492 } -cleanup {
44794493 destroy .t.f
44804494 } -returnCodes error -result {<Configure> event doesn't accept "-subwindow" option}
44874501 set x {}
44884502 } -body {
44894503 bind .t.f <Key> "lappend x %t"
4490 event gen .t.f <Key> -time xyz
4504 event generate .t.f <Key> -time xyz
44914505 } -cleanup {
44924506 destroy .t.f
44934507 } -returnCodes error -result {expected integer but got "xyz"}
45004514 set x {}
45014515 } -body {
45024516 bind .t.f <Key> "lappend x %t"
4503 event gen .t.f <Key> -time 100
4517 event generate .t.f <Key> -time 100
45044518 return $x
45054519 } -cleanup {
45064520 destroy .t.f
45144528 set x {}
45154529 } -body {
45164530 bind .t.f <Button> "lappend x %t"
4517 event gen .t.f <Button> -time 100
4531 event generate .t.f <Button> -time 100
45184532 return $x
45194533 } -cleanup {
45204534 destroy .t.f
45284542 set x {}
45294543 } -body {
45304544 bind .t.f <ButtonRelease> "lappend x %t"
4531 event gen .t.f <ButtonRelease> -time 100
4545 event generate .t.f <ButtonRelease> -time 100
45324546 return $x
45334547 } -cleanup {
45344548 destroy .t.f
45424556 set x {}
45434557 } -body {
45444558 bind .t.f <Motion> "lappend x %t"
4545 event gen .t.f <Motion> -time 100
4559 event generate .t.f <Motion> -time 100
45464560 return $x
45474561 } -cleanup {
45484562 destroy .t.f
45564570 set x {}
45574571 } -body {
45584572 bind .t.f <<Paste>> "lappend x %t"
4559 event gen .t.f <<Paste>> -time 100
4573 event generate .t.f <<Paste>> -time 100
45604574 return $x
45614575 } -cleanup {
45624576 destroy .t.f
45704584 set x {}
45714585 } -body {
45724586 bind .t.f <Enter> "lappend x %t"
4573 event gen .t.f <Enter> -time 100
4587 event generate .t.f <Enter> -time 100
45744588 return $x
45754589 } -cleanup {
45764590 destroy .t.f
45844598 set x {}
45854599 } -body {
45864600 bind .t.f <Property> "lappend x %t"
4587 event gen .t.f <Property> -time 100
4601 event generate .t.f <Property> -time 100
45884602 return $x
45894603 } -cleanup {
45904604 destroy .t.f
45984612 set x {}
45994613 } -body {
46004614 bind .t.f <Configure> "lappend x %t"
4601 event gen .t.f <Configure> -time 100
4615 event generate .t.f <Configure> -time 100
46024616 } -cleanup {
46034617 destroy .t.f
46044618 } -returnCodes error -result {<Configure> event doesn't accept "-time" option}
46114625 set x {}
46124626 } -body {
46134627 bind .t.f <Expose> "lappend x %w"
4614 event gen .t.f <Expose> -width xyz
4628 event generate .t.f <Expose> -width xyz
46154629 } -cleanup {
46164630 destroy .t.f
46174631 } -returnCodes error -result {bad screen distance "xyz"}
46244638 set x {}
46254639 } -body {
46264640 bind .t.f <Expose> "lappend x %w"
4627 event gen .t.f <Expose> -width 2i
4641 event generate .t.f <Expose> -width 2i
46284642 expr {[winfo pixels .t.f 2i] eq $x}
46294643 } -cleanup {
46304644 destroy .t.f
46384652 set x {}
46394653 } -body {
46404654 bind .t.f <Configure> "lappend x %w"
4641 event gen .t.f <Configure> -width 2i
4655 event generate .t.f <Configure> -width 2i
46424656 expr {[winfo pixels .t.f 2i] eq $x}
46434657 } -cleanup {
46444658 destroy .t.f
46524666 set x {}
46534667 } -body {
46544668 bind .t.f <Key> "lappend x %k"
4655 event gen .t.f <Key> -width 2i
4669 event generate .t.f <Key> -width 2i
46564670 } -cleanup {
46574671 destroy .t.f
46584672 } -returnCodes error -result {<Key> event doesn't accept "-width" option}
46654679 set x {}
46664680 } -body {
46674681 bind .t.f <Unmap> "lappend x %W"
4668 event gen .t.f <Unmap> -window .xyz
4682 event generate .t.f <Unmap> -window .xyz
46694683 } -cleanup {
46704684 destroy .t.f
46714685 } -returnCodes error -result {bad window path name ".xyz"}
46784692 set x {}
46794693 } -body {
46804694 bind .t.f <Unmap> "lappend x %W"
4681 event gen .t.f <Unmap> -window .t.f
4695 event generate .t.f <Unmap> -window .t.f
46824696 return $x
46834697 } -cleanup {
46844698 destroy .t.f
46924706 set x {}
46934707 } -body {
46944708 bind .t.f <Unmap> "lappend x %W"
4695 event gen .t.f <Unmap> -window xyz
4709 event generate .t.f <Unmap> -window xyz
46964710 } -cleanup {
46974711 destroy .t.f
46984712 } -returnCodes error -result {bad window name/identifier "xyz"}
47054719 set x {}
47064720 } -body {
47074721 bind .t.f <Unmap> "lappend x %W"
4708 event gen .t.f <Unmap> -window [winfo id .t.f]
4722 event generate .t.f <Unmap> -window [winfo id .t.f]
47094723 return $x
47104724 } -cleanup {
47114725 destroy .t.f
47194733 set x {}
47204734 } -body {
47214735 bind .t.f <Unmap> "lappend x %W"
4722 event gen .t.f <Unmap> -window .t.f
4736 event generate .t.f <Unmap> -window .t.f
47234737 return $x
47244738 } -cleanup {
47254739 destroy .t.f
47334747 set x {}
47344748 } -body {
47354749 bind .t.f <Map> "lappend x %W"
4736 event gen .t.f <Map> -window .t.f
4750 event generate .t.f <Map> -window .t.f
47374751 return $x
47384752 } -cleanup {
47394753 destroy .t.f
47474761 set x {}
47484762 } -body {
47494763 bind .t.f <Reparent> "lappend x %W"
4750 event gen .t.f <Reparent> -window .t.f
4764 event generate .t.f <Reparent> -window .t.f
47514765 return $x
47524766 } -cleanup {
47534767 destroy .t.f
47614775 set x {}
47624776 } -body {
47634777 bind .t.f <Configure> "lappend x %W"
4764 event gen .t.f <Configure> -window .t.f
4778 event generate .t.f <Configure> -window .t.f
47654779 return $x
47664780 } -cleanup {
47674781 destroy .t.f
47754789 set x {}
47764790 } -body {
47774791 bind .t.f <Gravity> "lappend x %W"
4778 event gen .t.f <Gravity> -window .t.f
4792 event generate .t.f <Gravity> -window .t.f
47794793 return $x
47804794 } -cleanup {
47814795 destroy .t.f
47894803 set x {}
47904804 } -body {
47914805 bind .t.f <Circulate> "lappend x %W"
4792 event gen .t.f <Circulate> -window .t.f
4806 event generate .t.f <Circulate> -window .t.f
47934807 return $x
47944808 } -cleanup {
47954809 destroy .t.f
48034817 set x {}
48044818 } -body {
48054819 bind .t.f <Key> "lappend x %W"
4806 event gen .t.f <Key> -window .t.f
4820 event generate .t.f <Key> -window .t.f
48074821 } -cleanup {
48084822 destroy .t.f
48094823 } -returnCodes error -result {<Key> event doesn't accept "-window" option}
48164830 set x {}
48174831 } -body {
48184832 bind .t.f <Key> "lappend x %x"
4819 event gen .t.f <Key> -x xyz
4833 event generate .t.f <Key> -x xyz
48204834 } -cleanup {
48214835 destroy .t.f
48224836 } -returnCodes error -result {bad screen distance "xyz"}
48294843 set x {}
48304844 } -body {
48314845 bind .t.f <Key> "lappend x %x"
4832 event gen .t.f <Key> -x 2i
4846 event generate .t.f <Key> -x 2i
48334847 expr {[winfo pixels .t.f 2i] eq $x}
48344848 } -cleanup {
48354849 destroy .t.f
48434857 set x {}
48444858 } -body {
48454859 bind .t.f <Button> "lappend x %x"
4846 event gen .t.f <Button> -x 2i
4860 event generate .t.f <Button> -x 2i
48474861 expr {[winfo pixels .t.f 2i] eq $x}
48484862 } -cleanup {
48494863 destroy .t.f
48574871 set x {}
48584872 } -body {
48594873 bind .t.f <ButtonRelease> "lappend x %x"
4860 event gen .t.f <ButtonRelease> -x 2i
4874 event generate .t.f <ButtonRelease> -x 2i
48614875 expr {[winfo pixels .t.f 2i] eq $x}
48624876 } -cleanup {
48634877 destroy .t.f
48714885 set x {}
48724886 } -body {
48734887 bind .t.f <Motion> "lappend x %x"
4874 event gen .t.f <Motion> -x 2i
4888 event generate .t.f <Motion> -x 2i
48754889 expr {[winfo pixels .t.f 2i] eq $x}
48764890 } -cleanup {
48774891 destroy .t.f
48854899 set x {}
48864900 } -body {
48874901 bind .t.f <<Paste>> "lappend x %x"
4888 event gen .t.f <<Paste>> -x 2i
4902 event generate .t.f <<Paste>> -x 2i
48894903 expr {[winfo pixels .t.f 2i] eq $x}
48904904 } -cleanup {
48914905 destroy .t.f
48994913 set x {}
49004914 } -body {
49014915 bind .t.f <Enter> "lappend x %x"
4902 event gen .t.f <Enter> -x 2i
4916 event generate .t.f <Enter> -x 2i
49034917 expr {[winfo pixels .t.f 2i] eq $x}
49044918 } -cleanup {
49054919 destroy .t.f
49134927 set x {}
49144928 } -body {
49154929 bind .t.f <Expose> "lappend x %x"
4916 event gen .t.f <Expose> -x 2i
4930 event generate .t.f <Expose> -x 2i
49174931 expr {[winfo pixels .t.f 2i] eq $x}
49184932 } -cleanup {
49194933 destroy .t.f
49274941 set x {}
49284942 } -body {
49294943 bind .t.f <Configure> "lappend x %x"
4930 event gen .t.f <Configure> -x 2i
4944 event generate .t.f <Configure> -x 2i
49314945 expr {[winfo pixels .t.f 2i] eq $x}
49324946 } -cleanup {
49334947 destroy .t.f
49414955 set x {}
49424956 } -body {
49434957 bind .t.f <Gravity> "lappend x %x"
4944 event gen .t.f <Gravity> -x 2i
4958 event generate .t.f <Gravity> -x 2i
49454959 expr {[winfo pixels .t.f 2i] eq $x}
49464960 } -cleanup {
49474961 destroy .t.f
49554969 set x {}
49564970 } -body {
49574971 bind .t.f <Reparent> "lappend x %x"
4958 event gen .t.f <Reparent> -x 2i
4972 event generate .t.f <Reparent> -x 2i
49594973 expr {[winfo pixels .t.f 2i] eq $x}
49604974 } -cleanup {
49614975 destroy .t.f
49694983 set x {}
49704984 } -body {
49714985 bind .t.f <Map> "lappend x %x"
4972 event gen .t.f <Map> -x 2i
4986 event generate .t.f <Map> -x 2i
49734987 } -cleanup {
49744988 destroy .t.f
49754989 } -returnCodes error -result {<Map> event doesn't accept "-x" option}
49824996 set x {}
49834997 } -body {
49844998 bind .t.f <Key> "lappend x %y"
4985 event gen .t.f <Key> -y xyz
4999 event generate .t.f <Key> -y xyz
49865000 } -cleanup {
49875001 destroy .t.f
49885002 } -returnCodes error -result {bad screen distance "xyz"}
49955009 set x {}
49965010 } -body {
49975011 bind .t.f <Key> "lappend x %y"
4998 event gen .t.f <Key> -y 2i
5012 event generate .t.f <Key> -y 2i
49995013 expr {[winfo pixels .t.f 2i] eq $x}
50005014 } -cleanup {
50015015 destroy .t.f
50095023 set x {}
50105024 } -body {
50115025 bind .t.f <Button> "lappend x %y"
5012 event gen .t.f <Button> -y 2i
5026 event generate .t.f <Button> -y 2i
50135027 expr {[winfo pixels .t.f 2i] eq $x}
50145028 } -cleanup {
50155029 destroy .t.f
50235037 set x {}
50245038 } -body {
50255039 bind .t.f <ButtonRelease> "lappend x %y"
5026 event gen .t.f <ButtonRelease> -y 2i
5040 event generate .t.f <ButtonRelease> -y 2i
50275041 expr {[winfo pixels .t.f 2i] eq $x}
50285042 } -cleanup {
50295043 destroy .t.f
50375051 set x {}
50385052 } -body {
50395053 bind .t.f <Motion> "lappend x %y"
5040 event gen .t.f <Motion> -y 2i
5054 event generate .t.f <Motion> -y 2i
50415055 expr {[winfo pixels .t.f 2i] eq $x}
50425056 } -cleanup {
50435057 destroy .t.f
50515065 set x {}
50525066 } -body {
50535067 bind .t.f <<Paste>> "lappend x %y"
5054 event gen .t.f <<Paste>> -y 2i
5068 event generate .t.f <<Paste>> -y 2i
50555069 expr {[winfo pixels .t.f 2i] eq $x}
50565070 } -cleanup {
50575071 destroy .t.f
50655079 set x {}
50665080 } -body {
50675081 bind .t.f <Enter> "lappend x %y"
5068 event gen .t.f <Enter> -y 2i
5082 event generate .t.f <Enter> -y 2i
50695083 expr {[winfo pixels .t.f 2i] eq $x}
50705084 } -cleanup {
50715085 destroy .t.f
50795093 set x {}
50805094 } -body {
50815095 bind .t.f <Expose> "lappend x %y"
5082 event gen .t.f <Expose> -y 2i
5096 event generate .t.f <Expose> -y 2i
50835097 expr {[winfo pixels .t.f 2i] eq $x}
50845098 } -cleanup {
50855099 destroy .t.f
50935107 set x {}
50945108 } -body {
50955109 bind .t.f <Configure> "lappend x %y"
5096 event gen .t.f <Configure> -y 2i
5110 event generate .t.f <Configure> -y 2i
50975111 expr {[winfo pixels .t.f 2i] eq $x}
50985112 } -cleanup {
50995113 destroy .t.f
51075121 set x {}
51085122 } -body {
51095123 bind .t.f <Gravity> "lappend x %y"
5110 event gen .t.f <Gravity> -y 2i
5124 event generate .t.f <Gravity> -y 2i
51115125 expr {[winfo pixels .t.f 2i] eq $x}
51125126 } -cleanup {
51135127 destroy .t.f
51215135 set x {}
51225136 } -body {
51235137 bind .t.f <Reparent> "lappend x %y"
5124 event gen .t.f <Reparent> -y 2i
5138 event generate .t.f <Reparent> -y 2i
51255139 expr {[winfo pixels .t.f 2i] eq $x}
51265140 } -cleanup {
51275141 destroy .t.f
51355149 set x {}
51365150 } -body {
51375151 bind .t.f <Map> "lappend x %y"
5138 event gen .t.f <Map> -y 2i
5152 event generate .t.f <Map> -y 2i
51395153 } -cleanup {
51405154 destroy .t.f
51415155 } -returnCodes error -result {<Map> event doesn't accept "-y" option}
51485162 set x {}
51495163 } -body {
51505164 bind .t.f <Key> "lappend x %k"
5151 event gen .t.f <Key> -xyz 1
5165 event generate .t.f <Key> -xyz 1
51525166 } -cleanup {
51535167 destroy .t.f
51545168 } -returnCodes error -result {bad option "-xyz": must be -when, -above, -borderwidth, -button, -count, -data, -delta, -detail, -focus, -height, -keycode, -keysym, -mode, -override, -place, -root, -rootx, -rooty, -sendevent, -serial, -state, -subwindow, -time, -warp, -width, -window, -x, or -y}
52035217 bind .t.f <Triple-1> {lappend x triple}
52045218 bind .t.f <Quadruple-1> {lappend x quadruple}
52055219 set x press
5206 event gen .t.f <Button-1>
5207 event gen .t.f <ButtonRelease-1>
5220 event generate .t.f <Button-1>
5221 event generate .t.f <ButtonRelease-1>
52085222 lappend x press
5209 event gen .t.f <Button-1>
5210 event gen .t.f <ButtonRelease-1>
5223 event generate .t.f <Button-1>
5224 event generate .t.f <ButtonRelease-1>
52115225 lappend x press
5212 event gen .t.f <Button-1>
5213 event gen .t.f <ButtonRelease-1>
5226 event generate .t.f <Button-1>
5227 event generate .t.f <ButtonRelease-1>
52145228 lappend x press
5215 event gen .t.f <Button-1>
5216 event gen .t.f <ButtonRelease-1>
5229 event generate .t.f <Button-1>
5230 event generate .t.f <ButtonRelease-1>
52175231 lappend x press
5218 event gen .t.f <Button-1>
5219 event gen .t.f <ButtonRelease-1>
5232 event generate .t.f <Button-1>
5233 event generate .t.f <ButtonRelease-1>
52205234 set x
52215235 } -cleanup {
52225236 destroy .t.f
52325246 set x {}
52335247 } -body {
52345248 bind .t.f <Button-1><Button-2> {lappend x 1-2}
5235 event gen .t.f <Button-1>
5236 event gen .t.f <ButtonRelease-1>
5237 event gen .t.f <Button-2>
5238 event gen .t.f <ButtonRelease-2>
5249 event generate .t.f <Button-1>
5250 event generate .t.f <ButtonRelease-1>
5251 event generate .t.f <Button-2>
5252 event generate .t.f <ButtonRelease-2>
52395253 set x
52405254 } -cleanup {
52415255 destroy .t.f
52495263 } -body {
52505264 bind .t.f <Button-1><Button-2> {lappend x 1-2}
52515265 bind .t.f <Button-2> {lappend x 2}
5252 event gen .t.f <Button-3>
5253 event gen .t.f <Button-2>
5254 event gen .t.f <ButtonRelease-2>
5255 event gen .t.f <Button-1>
5256 event gen .t.f <ButtonRelease-1>
5257 event gen .t.f <Button-2>
5258 event gen .t.f <ButtonRelease-2>
5266 event generate .t.f <Button-3>
5267 event generate .t.f <Button-2>
5268 event generate .t.f <ButtonRelease-2>
5269 event generate .t.f <Button-1>
5270 event generate .t.f <ButtonRelease-1>
5271 event generate .t.f <Button-2>
5272 event generate .t.f <ButtonRelease-2>
52595273 set x
52605274 } -cleanup {
52615275 destroy .t.f
52695283 } -body {
52705284 bind .t.f <Button-1><Button-2> {lappend x 1-2}
52715285 bind .t.f <Button-2><Button-2> {lappend x 2-2}
5272 event gen .t.f <Button-3>
5273 event gen .t.f <Button-2>
5274 event gen .t.f <ButtonRelease-2>
5275 event gen .t.f <Button-2>
5276 event gen .t.f <ButtonRelease-2>
5277 event gen .t.f <Button-1>
5278 event gen .t.f <ButtonRelease-1>
5279 event gen .t.f <Button-2>
5280 event gen .t.f <ButtonRelease-2>
5286 event generate .t.f <Button-3>
5287 event generate .t.f <Button-2>
5288 event generate .t.f <ButtonRelease-2>
5289 event generate .t.f <Button-2>
5290 event generate .t.f <ButtonRelease-2>
5291 event generate .t.f <Button-1>
5292 event generate .t.f <ButtonRelease-1>
5293 event generate .t.f <Button-2>
5294 event generate .t.f <ButtonRelease-2>
52815295 set x
52825296 } -cleanup {
52835297 destroy .t.f
52915305 } -body {
52925306 bind .t.f <Button-2><Button-2> {lappend x 2-2}
52935307 bind .t.f <Double-Button-2> {lappend x d-2}
5294 event gen .t.f <Button-3>
5295 event gen .t.f <Button-2>
5296 event gen .t.f <ButtonRelease-2>
5297 event gen .t.f <Button-2>
5298 event gen .t.f <ButtonRelease-2>
5299 event gen .t.f <Button-1>
5300 event gen .t.f <ButtonRelease-1>
5301 event gen .t.f <Button-2> -x 100
5302 event gen .t.f <ButtonRelease-2>
5303 event gen .t.f <Button-2> -x 200
5304 event gen .t.f <ButtonRelease-2>
5308 event generate .t.f <Button-3>
5309 event generate .t.f <Button-2>
5310 event generate .t.f <ButtonRelease-2>
5311 event generate .t.f <Button-2>
5312 event generate .t.f <ButtonRelease-2>
5313 event generate .t.f <Button-1>
5314 event generate .t.f <ButtonRelease-1>
5315 event generate .t.f <Button-2> -x 100
5316 event generate .t.f <ButtonRelease-2>
5317 event generate .t.f <Button-2> -x 200
5318 event generate .t.f <ButtonRelease-2>
53055319 set x
53065320 } -cleanup {
53075321 destroy .t.f
57455759 } -body {
57465760 bind .t.f <Motion> "set x {event Motion}"
57475761 set x xyzzy
5748 event gen .t.f <Motion>
5762 event generate .t.f <Motion>
57495763 list $x [bind .t.f]
57505764 } -cleanup {
57515765 destroy .t.f
57595773 } -body {
57605774 bind .t.f <Button> "set x {event Button}"
57615775 set x xyzzy
5762 event gen .t.f <Button>
5776 event generate .t.f <Button>
57635777 list $x [bind .t.f]
57645778 } -cleanup {
57655779 destroy .t.f
57735787 } -body {
57745788 bind .t.f <ButtonPress> "set x {event ButtonPress}"
57755789 set x xyzzy
5776 event gen .t.f <ButtonPress>
5790 event generate .t.f <ButtonPress>
57775791 list $x [bind .t.f]
57785792 } -cleanup {
57795793 destroy .t.f
57875801 } -body {
57885802 bind .t.f <ButtonRelease> "set x {event ButtonRelease}"
57895803 set x xyzzy
5790 event gen .t.f <ButtonRelease>
5804 event generate .t.f <ButtonRelease>
57915805 list $x [bind .t.f]
57925806 } -cleanup {
57935807 destroy .t.f
58015815 } -body {
58025816 bind .t.f <Colormap> "set x {event Colormap}"
58035817 set x xyzzy
5804 event gen .t.f <Colormap>
5818 event generate .t.f <Colormap>
58055819 list $x [bind .t.f]
58065820 } -cleanup {
58075821 destroy .t.f
58155829 } -body {
58165830 bind .t.f <Enter> "set x {event Enter}"
58175831 set x xyzzy
5818 event gen .t.f <Enter>
5832 event generate .t.f <Enter>
58195833 list $x [bind .t.f]
58205834 } -cleanup {
58215835 destroy .t.f
58295843 } -body {
58305844 bind .t.f <Leave> "set x {event Leave}"
58315845 set x xyzzy
5832 event gen .t.f <Leave>
5846 event generate .t.f <Leave>
58335847 list $x [bind .t.f]
58345848 } -cleanup {
58355849 destroy .t.f
58435857 } -body {
58445858 bind .t.f <Expose> "set x {event Expose}"
58455859 set x xyzzy
5846 event gen .t.f <Expose>
5860 event generate .t.f <Expose>
58475861 list $x [bind .t.f]
58485862 } -cleanup {
58495863 destroy .t.f
58575871 } -body {
58585872 bind .t.f <Key> "set x {event Key}"
58595873 set x xyzzy
5860 event gen .t.f <Key>
5874 event generate .t.f <Key>
58615875 list $x [bind .t.f]
58625876 } -cleanup {
58635877 destroy .t.f
58715885 } -body {
58725886 bind .t.f <KeyPress> "set x {event KeyPress}"
58735887 set x xyzzy
5874 event gen .t.f <KeyPress>
5888 event generate .t.f <KeyPress>
58755889 list $x [bind .t.f]
58765890 } -cleanup {
58775891 destroy .t.f
58855899 } -body {
58865900 bind .t.f <KeyRelease> "set x {event KeyRelease}"
58875901 set x xyzzy
5888 event gen .t.f <KeyRelease>
5902 event generate .t.f <KeyRelease>
58895903 list $x [bind .t.f]
58905904 } -cleanup {
58915905 destroy .t.f
58995913 } -body {
59005914 bind .t.f <Property> "set x {event Property}"
59015915 set x xyzzy
5902 event gen .t.f <Property>
5916 event generate .t.f <Property>
59035917 list $x [bind .t.f]
59045918 } -cleanup {
59055919 destroy .t.f
59135927 } -body {
59145928 bind .t.f <Visibility> "set x {event Visibility}"
59155929 set x xyzzy
5916 event gen .t.f <Visibility>
5930 event generate .t.f <Visibility>
59175931 list $x [bind .t.f]
59185932 } -cleanup {
59195933 destroy .t.f
59275941 } -body {
59285942 bind .t.f <Activate> "set x {event Activate}"
59295943 set x xyzzy
5930 event gen .t.f <Activate>
5944 event generate .t.f <Activate>
59315945 list $x [bind .t.f]
59325946 } -cleanup {
59335947 destroy .t.f
59415955 } -body {
59425956 bind .t.f <Deactivate> "set x {event Deactivate}"
59435957 set x xyzzy
5944 event gen .t.f <Deactivate>
5958 event generate .t.f <Deactivate>
59455959 list $x [bind .t.f]
59465960 } -cleanup {
59475961 destroy .t.f
59575971 } -body {
59585972 bind .t.f <Circulate> "set x {event Circulate}"
59595973 set x xyzzy
5960 event gen .t.f <Circulate>
5974 event generate .t.f <Circulate>
59615975 list $x [bind .t.f]
59625976 } -cleanup {
59635977 destroy .t.f
59715985 } -body {
59725986 bind .t.f <Configure> "set x {event Configure}"
59735987 set x xyzzy
5974 event gen .t.f <Configure>
5988 event generate .t.f <Configure>
59755989 list $x [bind .t.f]
59765990 } -cleanup {
59775991 destroy .t.f
59855999 } -body {
59866000 bind .t.f <Gravity> "set x {event Gravity}"
59876001 set x xyzzy
5988 event gen .t.f <Gravity>
6002 event generate .t.f <Gravity>
59896003 list $x [bind .t.f]
59906004 } -cleanup {
59916005 destroy .t.f
59996013 } -body {
60006014 bind .t.f <Map> "set x {event Map}"
60016015 set x xyzzy
6002 event gen .t.f <Map>
6016 event generate .t.f <Map>
60036017 list $x [bind .t.f]
60046018 } -cleanup {
60056019 destroy .t.f
60136027 } -body {
60146028 bind .t.f <Reparent> "set x {event Reparent}"
60156029 set x xyzzy
6016 event gen .t.f <Reparent>
6030 event generate .t.f <Reparent>
60176031 list $x [bind .t.f]
60186032 } -cleanup {
60196033 destroy .t.f
60276041 } -body {
60286042 bind .t.f <Unmap> "set x {event Unmap}"
60296043 set x xyzzy
6030 event gen .t.f <Unmap>
6044 event generate .t.f <Unmap>
60316045 list $x [bind .t.f]
60326046 } -cleanup {
60336047 destroy .t.f
60486062 } -body {
60496063 bind .t.f <Button-1> {lappend x "button 1"}
60506064 set x [bind .t.f]
6051 event gen .t.f <Button-1>
6052 event gen .t.f <ButtonRelease-1>
6065 event generate .t.f <Button-1>
6066 event generate .t.f <ButtonRelease-1>
60536067 set x
60546068 } -cleanup {
60556069 destroy .t.f
60626076 } -body {
60636077 bind .t.f <Button-2> {lappend x "button 2"}
60646078 set x [bind .t.f]
6065 event gen .t.f <Button-2>
6066 event gen .t.f <ButtonRelease-2>
6079 event generate .t.f <Button-2>
6080 event generate .t.f <ButtonRelease-2>
60676081 set x
60686082 } -cleanup {
60696083 destroy .t.f
60766090 } -body {
60776091 bind .t.f <Button-3> {lappend x "button 3"}
60786092 set x [bind .t.f]
6079 event gen .t.f <Button-3>
6080 event gen .t.f <ButtonRelease-3>
6093 event generate .t.f <Button-3>
6094 event generate .t.f <ButtonRelease-3>
60816095 set x
60826096 } -cleanup {
60836097 destroy .t.f
60906104 } -body {
60916105 bind .t.f <Button-4> {lappend x "button 4"}
60926106 set x [bind .t.f]
6093 event gen .t.f <Button-4>
6094 event gen .t.f <ButtonRelease-4>
6107 event generate .t.f <Button-4>
6108 event generate .t.f <ButtonRelease-4>
60956109 set x
60966110 } -cleanup {
60976111 destroy .t.f
61046118 } -body {
61056119 bind .t.f <Button-5> {lappend x "button 5"}
61066120 set x [bind .t.f]
6107 event gen .t.f <Button-5>
6108 event gen .t.f <ButtonRelease-5>
6121 event generate .t.f <Button-5>
6122 event generate .t.f <ButtonRelease-5>
61096123 set x
61106124 } -cleanup {
61116125 destroy .t.f
61356149 focus -force .t.f
61366150 update
61376151 } -body {
6138 bind .t.f <Key-a> "lappend x \"keysym a\""
6139 bind .t.f <Key-x> "lappend x {bad binding match}"
6152 bind .t.f <Key-:> "lappend x \"keysym received\""
6153 bind .t.f <Key-_> "lappend x {bad binding match}"
61406154 set x [lsort [bind .t.f]]
6141 event gen .t.f <Key-a> -state 0
6155 event generate .t.f <Key-:> ;# -state 0
61426156 set x
61436157 } -cleanup {
61446158 destroy .t.f
6145 } -result {a x {keysym a}}
6159 } -result {: _ {keysym received}}
61466160 test bind-28.6 {keysym names} -setup {
61476161 frame .t.f -class Test -width 150 -height 100
61486162 pack .t.f
61526166 bind .t.f <Key-Return> "lappend x \"keysym Return\""
61536167 bind .t.f <Key-x> "lappend x {bad binding match}"
61546168 set x [lsort [bind .t.f]]
6155 event gen .t.f <Key-Return> -state 0
6169 event generate .t.f <Key-Return> -state 0
61566170 set x
61576171 } -cleanup {
61586172 destroy .t.f
61666180 bind .t.f <Key-X> "lappend x \"keysym X\""
61676181 bind .t.f <Key-x> "lappend x {bad binding match}"
61686182 set x [lsort [bind .t.f]]
6169 event gen .t.f <Key-X> -state 1
6183 event generate .t.f <Key-X> -state 1
61706184 set x
61716185 } -cleanup {
61726186 destroy .t.f
61806194 bind .t.f <Key-X> "lappend x \"keysym X\""
61816195 bind .t.f <Key-x> "lappend x {bad binding match}"
61826196 set x [lsort [bind .t.f]]
6183 event gen .t.f <Key-X> -state 1
6197 event generate .t.f <Key-X> -state 1
61846198 set x
61856199 } -cleanup {
61866200 destroy .t.f
61996213 } -body {
62006214 bind .t.f <Button> {error "This is a test"}
62016215 set x none
6202 event gen .t.f <Button>
6203 event gen .t.f <ButtonRelease>
6216 event generate .t.f <Button>
6217 event generate .t.f <ButtonRelease>
62046218 update
62056219 set x
62066220 } -cleanup {
62136227
62146228 test bind-29.2 {Tk_BackgroundError procedure} -setup {
62156229 proc do {} {
6216 event gen .t.f <Button>
6217 event gen .t.f <ButtonRelease>
6230 event generate .t.f <Button>
6231 event generate .t.f <ButtonRelease>
62186232 }
62196233 proc bgerror msg {
62206234 global x errorInfo
62486262 set x {}
62496263 } -body {
62506264 bind .t.f <MouseWheel> {set x Wheel}
6251 event gen .t.f <MouseWheel>
6265 event generate .t.f <MouseWheel>
62526266 set x
62536267 } -cleanup {
62546268 destroy .t.f
62616275 set x {}
62626276 } -body {
62636277 bind .t.f <MouseWheel> {set x %D}
6264 event gen .t.f <MouseWheel> -delta 120
6278 event generate .t.f <MouseWheel> -delta 120
62656279 set x
62666280 } -cleanup {
62676281 destroy .t.f
62746288 set x {}
62756289 } -body {
62766290 bind .t.f <MouseWheel> {set x "%D %x %y"}
6277 event gen .t.f <MouseWheel> -delta 240 -x 10 -y 30
6291 event generate .t.f <MouseWheel> -delta 240 -x 10 -y 30
62786292 set x
62796293 } -cleanup {
62806294 destroy .t.f
62886302 update
62896303 } -body {
62906304 # Check no confusion, since Focus events use %d for something else
6291 event gen .t.f <FocusIn> -data foo
6305 event generate .t.f <FocusIn> -data foo
62926306 } -cleanup {
62936307 destroy .t.f
62946308 } -returnCodes error -result {<FocusIn> event doesn't accept "-data" option}
63006314 set x {}
63016315 } -body {
63026316 bind .t.f <<TestUserData>> {set x "TestUserData >%d<"}
6303 event gen .t.f <<TestUserData>>
6317 event generate .t.f <<TestUserData>>
63046318 set x
63056319 } -cleanup {
63066320 destroy .t.f
63136327 set x {}
63146328 } -body {
63156329 bind .t.f <<TestUserData>> {set x "TestUserData >%d<"}
6316 event gen .t.f <<TestUserData>> -data "foo bar"
6330 event generate .t.f <<TestUserData>> -data "foo bar"
63176331 set x
63186332 } -cleanup {
63196333 destroy .t.f
63266340 set x {}
63276341 } -body {
63286342 bind .t.f <<TestUserData>> {set x "TestUserData >%d<"}
6329 event gen .t.f <<TestUserData>> -data [string index abc 1]
6343 event generate .t.f <<TestUserData>> -data [string index abc 1]
63306344 set x
63316345 } -cleanup {
63326346 destroy .t.f
63436357 set x {}
63446358 } -body {
63456359 bind .t.f <<TestUserData>> {set x "TestUserData >%d<"}
6346 event gen .t.f <<TestUserData>> -when head
6360 event generate .t.f <<TestUserData>> -when head
63476361 list $x [update] $x
63486362 } -cleanup {
63496363 destroy .t.f
63566370 set x {}
63576371 } -body {
63586372 bind .t.f <<TestUserData>> {set x "TestUserData >%d<"}
6359 event gen .t.f <<TestUserData>> -data "foo bar" -when head
6373 event generate .t.f <<TestUserData>> -data "foo bar" -when head
63606374 list $x [update] $x
63616375 } -cleanup {
63626376 destroy .t.f
63696383 set x {}
63706384 } -body {
63716385 bind .t.f <<TestUserData>> {set x "TestUserData >%d<"}
6372 event gen .t.f <<TestUserData>> -data [string index abc 1] -when head
6386 event generate .t.f <<TestUserData>> -data [string index abc 1] -when head
63736387 list $x [update] $x
63746388 } -cleanup {
63756389 destroy .t.f
63836397 # Local Variables:
63846398 # mode: tcl
63856399 # End:
6386
6387
6388
6389
6390
6391
6392
6393
0 # Tests for the tk busy command.
1 #
2 # This file contains a collection of tests for one or more of the Tk built-in
3 # commands. Sourcing this file runs the tests and generates output for errors.
4 # No output means no errors were found.
5 #
6 # Copyright (c) 1998-2000 by Jos Decoster. All rights reserved.
7 #
8 # RCS: @(#) $Id: busy.test,v 1.2 2008/11/03 11:54:25 patthoyts Exp $
9
10 package require tcltest 2.1
11 tcltest::configure {*}$argv
12 tcltest::loadTestedCommands
13 namespace import -force tcltest::test
14
15 # There's currently no way to test the actual grab effect, per se, in an
16 # automated test. Therefore, this test suite only covers the interface to the
17 # grab command (ie, error messages, etc.)
18
19 test busy-1.1 {Tk_BusyObjCmd} -returnCodes error -body {
20 tk busy
21 } -result {wrong # args: should be "tk busy options ?arg arg ...?"}
22
23 test busy-2.1 {tk busy hold} -returnCodes error -body {
24 tk busy hold
25 } -result {wrong # args: should be "tk busy hold window ?option value ...?"}
26 test busy-2.2 {tk busy hold root window} -body {
27 tk busy hold .
28 update
29 } -cleanup {
30 tk busy forget .
31 } -result {}
32 test busy-2.3 {tk busy hold root window with shortcut} -body {
33 tk busy .
34 update
35 } -cleanup {
36 tk busy forget .
37 } -result {}
38 test busy-2.4 {tk busy hold nested window} -setup {
39 pack [frame .f]
40 } -body {
41 tk busy hold .f
42 update
43 } -cleanup {
44 tk busy forget .f
45 destroy .f
46 } -result {}
47 test busy-2.5 {tk busy hold nested window with shortcut} -setup {
48 pack [frame .f]
49 } -body {
50 tk busy .f
51 update
52 } -cleanup {
53 tk busy forget .f
54 destroy .f
55 } -result {}
56 test busy-2.6 {tk busy hold toplevel window} -setup {
57 toplevel .f
58 } -body {
59 tk busy hold .f
60 update
61 } -cleanup {
62 tk busy forget .f
63 destroy .f
64 } -result {}
65 test busy-2.7 {tk busy hold toplevel window with shortcut} -setup {
66 toplevel .f
67 } -body {
68 tk busy .f
69 update
70 } -cleanup {
71 tk busy forget .f
72 destroy .f
73 } -result {}
74 test busy-2.8 {tk busy hold non existing window} -body {
75 tk busy hold .f
76 update
77 } -returnCodes error -result {bad window path name ".f"}
78 test busy-2.9 {tk busy hold (shortcut) non existing window} -body {
79 tk busy .f
80 update
81 } -returnCodes {error} -result {bad window path name ".f"}
82 test busy-2.10 {tk busy hold root window with cursor} -body {
83 tk busy hold . -cursor arrow
84 update
85 } -cleanup {
86 tk busy forget .
87 } -result {}
88 test busy-2.11 {tk busy hold (shortcut) root window, cursor} -body {
89 tk busy . -cursor arrow
90 update
91 } -cleanup {
92 tk busy forget .
93 } -result {}
94 test busy-2.12 {tk busy hold root window, invalid cursor} -body {
95 tk busy hold . -cursor nonExistingCursor
96 update
97 } -constraints tempNotMac -returnCodes error -cleanup {
98 tk busy forget .
99 } -result {bad cursor spec "nonExistingCursor"}
100 test busy-2.13 {tk busy hold (shortcut) root window, invalid cursor} -body {
101 tk busy . -cursor nonExistingCursor
102 update
103 } -constraints tempNotMac -returnCodes error -cleanup {
104 tk busy forget .
105 } -result {bad cursor spec "nonExistingCursor"}
106 test busy-2.14 {tk busy hold root window, invalid option} -body {
107 tk busy hold . -invalidOption 1
108 update
109 } -constraints tempNotMac -returnCodes error -cleanup {
110 tk busy forget .
111 } -result {unknown option "-invalidOption"}
112 test busy-2.15 {tk busy hold (shortcut) root window, invalid option} -body {
113 tk busy . -invalidOption 1
114 update
115 } -constraints tempNotMac -returnCodes error -cleanup {
116 tk busy forget .
117 } -result {unknown option "-invalidOption"}
118
119 test busy-3.1 {tk busy cget no window} -returnCodes error -body {
120 tk busy cget
121 } -result {wrong # args: should be "tk busy cget window option"}
122 test busy-3.2 {tk busy cget no option} -returnCodes error -body {
123 tk busy cget
124 } -result {wrong # args: should be "tk busy cget window option"}
125 test busy-3.3 {tk busy cget invalid window} -returnCodes error -body {
126 tk busy cget .f -cursor
127 } -result {bad window path name ".f"}
128 test busy-3.4 {tk busy cget non-busy window} -setup {
129 pack [frame .f]
130 } -body {
131 tk busy cget .f -cursor
132 } -cleanup {
133 destroy .f
134 } -returnCodes error -result {can't find busy window ".f"}
135 test busy-3.5 {tk busy cget invalid option} -setup {
136 pack [frame .f]
137 tk busy hold .f
138 update
139 } -body {
140 tk busy cget .f -invalidOption
141 } -cleanup {
142 tk busy forget .f
143 destroy .f
144 } -returnCodes error -result {unknown option "-invalidOption"}
145 test busy-3.6unix {tk busy cget unix} -setup {
146 pack [frame .f]
147 tk busy hold .f
148 update
149 } -body {
150 tk busy cget .f -cursor
151 } -cleanup {
152 tk busy forget .f
153 destroy .f
154 } -result {watch} -constraints unix
155 test busy-3.6win {tk busy cget win} -setup {
156 pack [frame .f]
157 tk busy hold .f
158 update
159 } -body {
160 tk busy cget .f -cursor
161 } -cleanup {
162 tk busy forget .f
163 destroy .f
164 } -result {wait} -constraints win
165 test busy-3.7 {tk busy cget unix} -setup {
166 pack [frame .f]
167 tk busy hold .f -cursor hand1
168 update
169 } -body {
170 tk busy cget .f -cursor
171 } -cleanup {
172 tk busy forget .f
173 destroy .f
174 } -result {hand1} -constraints tempNotMac
175
176 test busy-4.1 {tk busy configure no window} -returnCodes error -body {
177 tk busy configure
178 } -result {wrong # args: should be "tk busy configure window ?option? ?value ...?"}
179
180 test busy-4.2 {tk busy configure invalid window} -body {
181 tk busy configure .f
182 } -returnCodes error -result {bad window path name ".f"}
183
184 test busy-4.3 {tk busy configure non-busy window} -setup {
185 pack [frame .f]
186 } -body {
187 tk busy configure .f
188 } -cleanup {
189 destroy .f
190 } -returnCodes error -result {can't find busy window ".f"}
191
192 test busy-4.4 {tk busy configure} -constraints {nonwin} -setup {
193 pack [frame .f]
194 tk busy hold .f
195 update
196 } -body {
197 tk busy configure .f
198 } -cleanup {
199 tk busy forget .f
200 destroy .f
201 } -result {{-cursor cursor Cursor watch watch}}
202
203 test busy-4.4-win {tk busy configure} -constraints {win} -setup {
204 pack [frame .f]
205 tk busy hold .f
206 update
207 } -body {
208 tk busy configure .f
209 } -cleanup {
210 tk busy forget .f
211 destroy .f
212 } -result {{-cursor cursor Cursor wait wait}}
213
214 test busy-4.5 {tk busy configure} -constraints {nonwin tempNotMac} -setup {
215 pack [frame .f]
216 tk busy hold .f -cursor hand2
217 update
218 } -body {
219 tk busy configure .f
220 } -cleanup {
221 tk busy forget .f
222 destroy .f
223 } -result {{-cursor cursor Cursor watch hand2}}
224
225 test busy-4.5-win {tk busy configure} -constraints win -setup {
226 pack [frame .f]
227 tk busy hold .f -cursor hand2
228 update
229 } -body {
230 tk busy configure .f
231 } -cleanup {
232 tk busy forget .f
233 destroy .f
234 } -result {{-cursor cursor Cursor wait hand2}}
235
236 test busy-4.6 {tk busy configure invalid option} -setup {
237 pack [frame .f]
238 tk busy hold .f
239 update
240 } -body {
241 tk busy configure .f -invalidOption
242 } -cleanup {
243 tk busy forget .f
244 destroy .f
245 } -returnCodes error -result {unknown option "-invalidOption"}
246
247 test busy-4.7 {tk busy configure valid option} -constraints {nonwin} -setup {
248 pack [frame .f]
249 tk busy hold .f
250 update
251 } -body {
252 tk busy configure .f -cursor
253 } -cleanup {
254 tk busy forget .f
255 destroy .f
256 } -result {-cursor cursor Cursor watch watch}
257
258 test busy-4.7-win {tk busy configure valid option} -constraints {win} -setup {
259 pack [frame .f]
260 tk busy hold .f
261 update
262 } -body {
263 tk busy configure .f -cursor
264 } -cleanup {
265 tk busy forget .f
266 destroy .f
267 } -result {-cursor cursor Cursor wait wait}
268
269 test busy-4.8 {tk busy configure valid option} -constraints {
270 nonwin tempNotMac
271 } -setup {
272 pack [frame .f]
273 tk busy hold .f -cursor circle
274 update
275 } -body {
276 tk busy configure .f -cursor
277 } -cleanup {
278 tk busy forget .f
279 destroy .f
280 } -result {-cursor cursor Cursor watch circle}
281
282 test busy-4.8-win {tk busy configure valid option} -constraints win -setup {
283 pack [frame .f]
284 tk busy hold .f -cursor circle
285 update
286 } -body {
287 tk busy configure .f -cursor
288 } -cleanup {
289 tk busy forget .f
290 destroy .f
291 } -result {-cursor cursor Cursor wait circle}
292
293 test busy-4.9 {tk busy configure valid option with value} -setup {
294 pack [frame .f]
295 tk busy hold .f
296 update
297 } -body {
298 tk busy configure .f -cursor pencil
299 tk busy cget .f -cursor
300 } -cleanup {
301 tk busy forget .f
302 destroy .f
303 } -result {pencil} -constraints tempNotMac
304
305 test busy-4.10 {tk busy configure valid option with invalid value} -setup {
306 pack [frame .f]
307 tk busy hold .f
308 update
309 } -body {
310 tk busy configure .f -cursor nonExistingCursor
311 } -constraints tempNotMac -returnCodes error -cleanup {
312 tk busy forget .f
313 destroy .f
314 } -result {bad cursor spec "nonExistingCursor"}
315
316 test busy-5.1 {tk busy forget} -returnCodes error -body {
317 tk busy forget
318 } -result {wrong # args: should be "tk busy forget window"}
319 test busy-5.2 {tk busy forget non existing window} -body {
320 tk busy forget .f
321 } -returnCodes error -result {bad window path name ".f"}
322 test busy-5.3 {tk busy forget non busy window} -setup {
323 pack [frame .f]
324 } -body {
325 tk busy forget .f
326 } -cleanup {
327 destroy .f
328 } -returnCodes error -result {can't find busy window ".f"}
329 test busy-5.4 {tk busy forget window} -setup {
330 pack [frame .f]
331 tk busy hold .f
332 update
333 } -body {
334 set r [tk busy status .f]
335 tk busy forget .f
336 lappend r [tk busy status .f]
337 } -cleanup {
338 destroy .f
339 } -result {1 0}
340
341 test busy-6.1 {tk busy status} -returnCodes error -body {
342 tk busy status
343 } -result {wrong # args: should be "tk busy status window"}
344 test busy-6.2 {tk busy status non existing window} -body {
345 tk busy status .f
346 } -result {0}
347 test busy-6.3 {tk busy status non busy window} -setup {
348 pack [frame .f]
349 } -body {
350 tk busy status .f
351 } -cleanup {
352 destroy .f
353 } -result {0}
354 test busy-6.4 {tk busy status busy window} -setup {
355 pack [frame .f]
356 tk busy hold .f
357 update
358 } -body {
359 tk busy status .f
360 } -cleanup {
361 tk busy forget .f
362 destroy .f
363 } -result {1}
364 test busy-6.5 {tk busy status forgotten busy window} -setup {
365 pack [frame .f]
366 tk busy hold .f
367 update
368 tk busy forget .f
369 } -body {
370 tk busy status .f
371 } -cleanup {
372 destroy .f
373 } -result {0}
374
375 test busy-7.1 {tk busy current no busy} -body {
376 tk busy current
377 } -result {}
378 test busy-7.2 {tk busy current 1 busy} -setup {
379 pack [frame .f]
380 tk busy hold .f
381 update
382 } -body {
383 tk busy current
384 } -cleanup {
385 tk busy forget .f
386 destroy .f
387 } -result {.f}
388 test busy-7.3 {tk busy current 2 busy} -setup {
389 pack [frame .f1]
390 pack [frame .f2]
391 tk busy hold .f1
392 tk busy hold .f2
393 update
394 } -body {
395 lsort [tk busy current]
396 } -cleanup {
397 tk busy forget .f1
398 tk busy forget .f2
399 destroy .f1 .f2
400 } -result {.f1 .f2}
401 test busy-7.4 {tk busy current 2 busy with matching filter} -setup {
402 pack [frame .f1]
403 pack [frame .f2]
404 tk busy hold .f1
405 tk busy hold .f2
406 update
407 } -body {
408 lsort [tk busy current *2*]
409 } -cleanup {
410 tk busy forget .f1
411 tk busy forget .f2
412 destroy .f1 .f2
413 } -result {.f2}
414 test busy-7.5 {tk busy current 2 busy with non matching filter} -setup {
415 pack [frame .f1]
416 pack [frame .f2]
417 tk busy hold .f1
418 tk busy hold .f2
419 update
420 } -body {
421 lsort [tk busy current *3*]
422 } -cleanup {
423 tk busy forget .f1
424 tk busy forget .f2
425 destroy .f1 .f2
426 } -result {}
427 test busy-7.6 {tk busy current 1 busy after forget} -setup {
428 pack [frame .f]
429 tk busy hold .f
430 update
431 tk busy forget .f
432 } -body {
433 tk busy current
434 } -cleanup {
435 destroy .f
436 } -result {}
437 test busy-7.7 {tk busy current 2 busy after forget} -setup {
438 pack [frame .f1]
439 pack [frame .f2]
440 tk busy hold .f1
441 tk busy hold .f2
442 update
443 tk busy forget .f1
444 } -body {
445 lsort [tk busy current]
446 } -cleanup {
447 tk busy forget .f2
448 destroy .f1 .f2
449 } -result {.f2}
450 test busy-7.8 {tk busy current 2 busy with matching filter after forget} -setup {
451 pack [frame .f1]
452 pack [frame .f2]
453 tk busy hold .f1
454 tk busy hold .f2
455 update
456 tk busy forget .f1
457 } -body {
458 lsort [tk busy current *2*]
459 } -cleanup {
460 tk busy forget .f2
461 destroy .f1 .f2
462 } -result {.f2}
463 test busy-7.9 {tk busy current 2 busy with non matching filter after forget} -setup {
464 pack [frame .f1]
465 pack [frame .f2]
466 tk busy hold .f1
467 tk busy hold .f2
468 update
469 tk busy forget .f1
470 } -body {
471 lsort [tk busy current *3*]
472 } -cleanup {
473 tk busy forget .f2
474 destroy .f1 .f2
475 } -result {}
476
477 ::tcltest::cleanupTests
478 return
55 # Copyright (c) 1998-1999 by Scriptics Corporation.
66 # All rights reserved.
77 #
8 # RCS: @(#) $Id: canvText.test,v 1.20 2008/10/08 16:13:42 dgp Exp $
8 # RCS: @(#) $Id: canvText.test,v 1.22 2008/11/22 18:08:51 dkf Exp $
99
1010 package require tcltest 2.2
1111 namespace import ::tcltest::*
2626 test canvasText-1.2 {configuration options: bad value for "anchor"} -body {
2727 .c itemconfigure test -anchor xyz
2828 } -returnCodes error -result {bad anchor position "xyz": must be n, ne, e, se, s, sw, w, nw, or center}
29
3029 test canvText-1.3 {configuration options: good value for "fill"} -body {
3130 .c itemconfigure test -fill #ff0000
3231 list [lindex [.c itemconfigure test -fill] 4] [.c itemcget test -fill]
3837 .c itemconfigure test -fill {}
3938 list [lindex [.c itemconfigure test -fill] 4] [.c itemcget test -fill]
4039 } -result {{} {}}
41
4240 test canvText-1.6 {configuration options: good value for "font"} -body {
4341 .c itemconfigure test -font {Times 40}
4442 list [lindex [.c itemconfigure test -font] 4] [.c itemcget test -font]
4644 test canvasText-1.7 {configuration options: bad value for "font"} -body {
4745 .c itemconfigure test -font {}
4846 } -returnCodes error -result {font "" doesn't exist}
49
5047 test canvText-1.8 {configuration options: good value for "justify"} -body {
5148 .c itemconfigure test -justify left
5249 list [lindex [.c itemconfigure test -justify] 4] [.c itemcget test -justify]
5451 test canvasText-1.9 {configuration options: bad value for "justify"} -body {
5552 .c itemconfigure test -justify xyz
5653 } -returnCodes error -result {bad justification "xyz": must be left, right, or center}
57
5854 test canvText-1.10 {configuration options: good value for "stipple"} -body {
5955 .c itemconfigure test -stipple gray50
6056 list [lindex [.c itemconfigure test -stipple] 4] [.c itemcget test -stipple]
6258 test canvasText-1.11 {configuration options: bad value for "stipple"} -body {
6359 .c itemconfigure test -stipple xyz
6460 } -returnCodes error -result {bitmap "xyz" not defined}
65
6661 test canvText-1.12 {configuration options: good value for "underline"} -body {
6762 .c itemconfigure test -underline 0
6863 list [lindex [.c itemconfigure test -underline] 4] [.c itemcget test -underline]
7065 test canvasText-1.13 {configuration options: bad value for "underline"} -body {
7166 .c itemconfigure test -underline xyz
7267 } -returnCodes error -result {expected integer but got "xyz"}
73
7468 test canvText-1.14 {configuration options: good value for "width"} -body {
7569 .c itemconfigure test -width 6
7670 list [lindex [.c itemconfigure test -width] 4] [.c itemcget test -width]
7872 test canvasText-1.15 {configuration options: bad value for "width"} -body {
7973 .c itemconfigure test -width xyz
8074 } -returnCodes error -result {bad screen distance "xyz"}
81
8275 test canvText-1.16 {configuration options: good value for "tags"} -body {
8376 .c itemconfigure test -tags {test a b c}
8477 list [lindex [.c itemconfigure test -tags] 4] [.c itemcget test -tags]
8578 } -result {{test a b c} {test a b c}}
79 test canvasText-1.17 {configuration options: bad value for "angle"} -body {
80 .c itemconfigure test -angle xyz
81 } -returnCodes error -result {expected floating-point number but got "xyz"}
82 test canvasText-1.18 {configuration options: good value for "angle"} -body {
83 .c itemconfigure test -angle 32.5
84 list [lindex [.c itemconfigure test -angle] 4] [.c itemcget test -angle]
85 } -result {32.5 32.5}
86 test canvasText-1.19 {configuration options: bounding of "angle"} -body {
87 .c itemconfigure test -angle 390
88 set result [.c itemcget test -angle]
89 .c itemconfigure test -angle -30
90 lappend result [.c itemcget test -angle]
91 .c itemconfigure test -angle -360
92 lappend result [.c itemcget test -angle]
93 } -result {30.0 330.0 0.0}
8694 .c delete test
8795
8896
92100 test canvText-2.2 {CreateText procedure: args} -body {
93101 .c create text xyz 0
94102 } -cleanup {
95 .c delete all
103 .c delete all
96104 } -returnCodes {error} -result {bad screen distance "xyz"}
97105 test canvText-2.3 {CreateText procedure: args} -body {
98106 .c create text 0 xyz
99107 } -cleanup {
100 .c delete all
108 .c delete all
101109 } -returnCodes {error} -result {bad screen distance "xyz"}
102110 test canvText-2.4 {CreateText procedure: args} -body {
103111 .c create text 0 0 -xyz xyz
104112 } -cleanup {
105 .c delete all
113 .c delete all
106114 } -returnCodes {error} -result {unknown option "-xyz"}
107115 test canvText-2.5 {CreateText procedure} -body {
108116 .c create text 0 0 -tags x
113121
114122
115123 test canvText-3.1 {TextCoords procedure} -body {
116 .c create text 20 20 -tag test
117 .c coords test 0 0
118 update
124 .c create text 20 20 -tag test
125 .c coords test 0 0
126 update
119127 .c coords test
120128 } -cleanup {
121 .c delete test
129 .c delete test
122130 } -result {0.0 0.0}
123131 test canvText-3.2 {TextCoords procedure} -setup {
124 .c create text 20 20 -tag test
132 .c create text 20 20 -tag test
125133 } -body {
126134 .c coords test xyz 0
127135 } -cleanup {
128 .c delete test
136 .c delete test
129137 } -returnCodes {error} -result {bad screen distance "xyz"}
130138 test canvText-3.3 {TextCoords procedure} -setup {
131 .c create text 20 20 -tag test
139 .c create text 20 20 -tag test
132140 } -body {
133141 .c coords test 0 xyz
134142 } -cleanup {
135 .c delete test
143 .c delete test
136144 } -returnCodes {error} -result {bad screen distance "xyz"}
137145 test canvText-3.4 {TextCoords procedure} -setup {
138 .c create text 20 20 -tag test
146 .c create text 20 20 -tag test
139147 } -body {
140148 .c coords test 10 10
141149 set result {}
144152 }
145153 return $result
146154 } -cleanup {
147 .c delete test
155 .c delete test
148156 } -result {10.0 10.0}
149157 test canvText-3.5 {TextCoords procedure} -setup {
150 .c create text 20 20 -tag test
158 .c create text 20 20 -tag test
151159 } -body {
152160 .c coords test 10
153161 } -cleanup {
154 .c delete test
162 .c delete test
155163 } -returnCodes {error} -result {wrong # coordinates: expected 2, got 1}
156164 test canvText-3.6 {TextCoords procedure} -setup {
157 .c create text 20 20 -tag test
165 .c create text 20 20 -tag test
158166 } -body {
159167 .c coords test 10 10 10
160168 } -cleanup {
161 .c delete test
169 .c delete test
162170 } -returnCodes {error} -result {wrong # coordinates: expected 0 or 2, got 3}
163171
164172
165173 test canvText-4.1 {ConfigureText procedure} -setup {
166 .c create text 20 20 -tag test
174 .c create text 20 20 -tag test
167175 } -body {
168176 .c itemconfig test -fill xyz
169177 } -cleanup {
170 .c delete test
178 .c delete test
171179 } -returnCodes {error} -result {unknown color name "xyz"}
172180 test canvText-4.2 {ConfigureText procedure} -setup {
173 .c create text 20 20 -tag test
181 .c create text 20 20 -tag test
174182 } -body {
175183 .c itemconfig test -fill blue
176184 .c itemcget test -fill
177185 } -cleanup {
178 .c delete test
186 .c delete test
179187 } -result {blue}
180188 test canvText-4.3 {ConfigureText procedure: construct font gcs} -setup {
181 .c create text 20 20 -tag test
189 .c create text 20 20 -tag test
182190 } -body {
183191 .c itemconfig test -font "times 20" -fill black -stipple gray50
184192 list [.c itemcget test -font] [.c itemcget test -fill] [.c itemcget test -stipple]
185193 } -cleanup {
186 .c delete test
194 .c delete test
187195 } -result {{times 20} black gray50}
188196 test canvText-4.4 {ConfigureText procedure: construct cursor gc} -setup {
189 .c create text 20 20 -tag test
190 focus .c
191 .c focus test
197 .c create text 20 20 -tag test
198 focus .c
199 .c focus test
192200 } -body {
193201 .c itemconfig test -text "abcdefg"
194202 .c select from test 2
195203 .c select to test 4
196204 .c icursor test 3
197
198205 # Both black -> cursor becomes white.
199206 .c config -insertbackground black
200207 .c config -selectbackground black
201208 .c itemconfig test -just left
202209 update
203
204210 # Both same color (and not black) -> cursor becomes black.
205211 .c config -insertbackground red
206212 .c config -selectbackground red
207213 .c itemconfig test -just left
208214 update
209215 } -cleanup {
210 .c delete test
216 .c delete test
211217 } -result {}
212218 test canvText-4.5 {ConfigureText procedure: adjust selection} -setup {
213 .c create text 20 20 -tag test
214 focus .c
215 .c focus test
219 .c create text 20 20 -tag test
220 focus .c
221 .c focus test
216222 set x {}
217223 } -body {
218224 .c itemconfig test -text "abcdefghi"
234240 .c dchars test 4 end
235241 lappend x [selection get]
236242 } -cleanup {
237 .c delete test
243 .c delete test
238244 } -result {cdefg 1 cdefg cd cdef cd}
239245 test canvText-4.6 {ConfigureText procedure: adjust cursor} -setup {
240 .c create text 20 20 -tag test
246 .c create text 20 20 -tag test
241247 } -body {
242248 .c itemconfig test -text "abcdefghi"
243249 .c icursor test 6
249255
250256
251257 test canvText-5.1 {ConfigureText procedure: adjust cursor} -body {
252 .c create text 10 10 -tag x -fill blue -font "times 40" -stipple gray50 -text "xyz"
258 .c create text 10 10 -tag x -fill blue -font "times 40" -stipple gray50 \
259 -text "xyz"
253260 .c delete x
254261 } -result {}
255262
256263
257 test canvText-6.1 {ComputeTextBbox procedure} -constraints {
258 fonts
259 } -setup {
260 .c delete test
261 } -body {
262 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
263 set ay [font metrics $font -linespace]
264 set ax [font measure $font 0]
265
266 .c create text 0 0 -tag test
264 test canvText-6.1 {ComputeTextBbox procedure} -constraints fonts -setup {
265 .c delete test
266 } -body {
267 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
268 set ay [font metrics $font -linespace]
269 set ax [font measure $font 0]
270 .c create text 0 0 -tag test
267271 .c itemconfig test -font $font -text 0
268272 expr {[.c itemconfig test -anchor n; .c bbox test] \
269 eq "[expr -$ax/2-1] 0 [expr $ax/2+1] $ay"}
270 } -cleanup {
271 .c delete test
272 } -result 1
273 test canvText-6.2 {ComputeTextBbox procedure} -constraints {
274 fonts
275 } -setup {
276 .c delete test
277 } -body {
278 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
279 set ay [font metrics $font -linespace]
280 set ax [font measure $font 0]
281
282 .c create text 0 0 -tag test
273 eq "[expr -$ax/2-1] 0 [expr $ax/2+1] $ay"}
274 } -cleanup {
275 .c delete test
276 } -result 1
277 test canvText-6.2 {ComputeTextBbox procedure} -constraints fonts -setup {
278 .c delete test
279 } -body {
280 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
281 set ay [font metrics $font -linespace]
282 set ax [font measure $font 0]
283 .c create text 0 0 -tag test
283284 .c itemconfig test -font $font -text 0
284285 expr {[.c itemconfig test -anchor nw; .c bbox test] \
285 eq "-1 0 [expr $ax+1] $ay"}
286 } -cleanup {
287 .c delete test
288 } -result 1
289 test canvText-6.3 {ComputeTextBbox procedure} -constraints {
290 fonts
291 } -setup {
292 .c delete test
293 } -body {
294 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
295 set ay [font metrics $font -linespace]
296 set ax [font measure $font 0]
297
298 .c create text 0 0 -tag test
286 eq "-1 0 [expr $ax+1] $ay"}
287 } -cleanup {
288 .c delete test
289 } -result 1
290 test canvText-6.3 {ComputeTextBbox procedure} -constraints fonts -setup {
291 .c delete test
292 } -body {
293 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
294 set ay [font metrics $font -linespace]
295 set ax [font measure $font 0]
296 .c create text 0 0 -tag test
299297 .c itemconfig test -font $font -text 0
300298 expr {[.c itemconfig test -anchor w; .c bbox test] \
301 eq "-1 [expr -$ay/2] [expr $ax+1] [expr $ay/2]"}
302 } -cleanup {
303 .c delete test
304 } -result 1
305 test canvText-6.4 {ComputeTextBbox procedure} -constraints {
306 fonts
307 } -setup {
308 .c delete test
309 } -body {
310 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
311 set ay [font metrics $font -linespace]
312 set ax [font measure $font 0]
313
314 .c create text 0 0 -tag test
299 eq "-1 [expr -$ay/2] [expr $ax+1] [expr $ay/2]"}
300 } -cleanup {
301 .c delete test
302 } -result 1
303 test canvText-6.4 {ComputeTextBbox procedure} -constraints fonts -setup {
304 .c delete test
305 } -body {
306 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
307 set ay [font metrics $font -linespace]
308 set ax [font measure $font 0]
309 .c create text 0 0 -tag test
315310 .c itemconfig test -font $font -text 0
316311 expr {[.c itemconfig test -anchor sw; .c bbox test] \
317 eq "-1 -$ay [expr $ax+1] 0"}
318 } -cleanup {
319 .c delete test
320 } -result 1
321 test canvText-6.5 {ComputeTextBbox procedure} -constraints {
322 fonts
323 } -setup {
324 .c delete test
325 } -body {
326 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
327 set ay [font metrics $font -linespace]
328 set ax [font measure $font 0]
329
330 .c create text 0 0 -tag test
312 eq "-1 -$ay [expr $ax+1] 0"}
313 } -cleanup {
314 .c delete test
315 } -result 1
316 test canvText-6.5 {ComputeTextBbox procedure} -constraints fonts -setup {
317 .c delete test
318 } -body {
319 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
320 set ay [font metrics $font -linespace]
321 set ax [font measure $font 0]
322 .c create text 0 0 -tag test
331323 .c itemconfig test -font $font -text 0
332324 expr {[.c itemconfig test -anchor s; .c bbox test] \
333 eq "[expr -$ax/2-1] -$ay [expr $ax/2+1] 0"}
334 } -cleanup {
335 .c delete test
336 } -result 1
337 test canvText-6.6 {ComputeTextBbox procedure} -constraints {
338 fonts
339 } -setup {
340 .c delete test
341 } -body {
342 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
343 set ay [font metrics $font -linespace]
344 set ax [font measure $font 0]
345
346 .c create text 0 0 -tag test
325 eq "[expr -$ax/2-1] -$ay [expr $ax/2+1] 0"}
326 } -cleanup {
327 .c delete test
328 } -result 1
329 test canvText-6.6 {ComputeTextBbox procedure} -constraints fonts -setup {
330 .c delete test
331 } -body {
332 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
333 set ay [font metrics $font -linespace]
334 set ax [font measure $font 0]
335 .c create text 0 0 -tag test
347336 .c itemconfig test -font $font -text 0
348337 expr {[.c itemconfig test -anchor se; .c bbox test] \
349 eq "[expr -$ax-1] -$ay 1 0"}
350 } -cleanup {
351 .c delete test
352 } -result 1
353 test canvText-6.7 {ComputeTextBbox procedure} -constraints {
354 fonts
355 } -setup {
356 .c delete test
357 } -body {
358 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
359 set ay [font metrics $font -linespace]
360 set ax [font measure $font 0]
361
362 .c create text 0 0 -tag test
338 eq "[expr -$ax-1] -$ay 1 0"}
339 } -cleanup {
340 .c delete test
341 } -result 1
342 test canvText-6.7 {ComputeTextBbox procedure} -constraints fonts -setup {
343 .c delete test
344 } -body {
345 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
346 set ay [font metrics $font -linespace]
347 set ax [font measure $font 0]
348 .c create text 0 0 -tag test
363349 .c itemconfig test -font $font -text 0
364350 expr {[.c itemconfig test -anchor e; .c bbox test]\
365 eq "[expr -$ax-1] [expr -$ay/2] 1 [expr $ay/2]"}
366 } -cleanup {
367 .c delete test
368 } -result 1
369 test canvText-6.8 {ComputeTextBbox procedure} -constraints {
370 fonts
371 } -setup {
372 .c delete test
373 } -body {
374 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
375 set ay [font metrics $font -linespace]
376 set ax [font measure $font 0]
377
378 .c create text 0 0 -tag test
351 eq "[expr -$ax-1] [expr -$ay/2] 1 [expr $ay/2]"}
352 } -cleanup {
353 .c delete test
354 } -result 1
355 test canvText-6.8 {ComputeTextBbox procedure} -constraints fonts -setup {
356 .c delete test
357 } -body {
358 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
359 set ay [font metrics $font -linespace]
360 set ax [font measure $font 0]
361 .c create text 0 0 -tag test
379362 .c itemconfig test -font $font -text 0
380363 expr {[.c itemconfig test -anchor ne; .c bbox test] \
381 eq "[expr -$ax-1] 0 1 $ay"}
382 } -cleanup {
383 .c delete test
384 } -result 1
385 test canvText-6.9 {ComputeTextBbox procedure} -constraints {
386 fonts
387 } -setup {
388 .c delete test
389 } -body {
390 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
391 set ay [font metrics $font -linespace]
392 set ax [font measure $font 0]
393
394 .c create text 0 0 -tag test
364 eq "[expr -$ax-1] 0 1 $ay"}
365 } -cleanup {
366 .c delete test
367 } -result 1
368 test canvText-6.9 {ComputeTextBbox procedure} -constraints fonts -setup {
369 .c delete test
370 } -body {
371 set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*"
372 set ay [font metrics $font -linespace]
373 set ax [font measure $font 0]
374 .c create text 0 0 -tag test
395375 .c itemconfig test -font $font -text 0
396376 expr {[.c itemconfig test -anchor center; .c bbox test] \
397 eq "[expr -$ax/2-1] [expr -$ay/2] [expr $ax/2+1] [expr $ay/2]"}
398 } -cleanup {
399 .c delete test
377 eq "[expr -$ax/2-1] [expr -$ay/2] [expr $ax/2+1] [expr $ay/2]"}
378 } -cleanup {
379 .c delete test
400380 } -result 1
401381
402382
408388 .c focus test
409389 .c itemconfig test -text "abcd\nefghi\njklmnopq"
410390 test canvText-7.1 {DisplayText procedure: stippling} -body {
411 .c create text 20 20 -tag test
391 .c create text 20 20 -tag test
412392 .c itemconfig test -stipple gray50
413393 update
414394 .c itemconfig test -stipple {}
415395 update
416396 } -cleanup {
417 .c delete test
397 .c delete test
418398 } -result {}
419399 test canvText-7.2 {DisplayText procedure: draw selection} -setup {
420 .c create text 20 20 -tag test
421 focus .c
422 .c focus test
423 } -body {
424 .c itemconfig test -text "abcd\nefghi\njklmnopq"
400 .c create text 20 20 -tag test
401 focus .c
402 .c focus test
403 } -body {
404 .c itemconfig test -text "abcd\nefghi\njklmnopq"
425405 .c select from test 0
426406 .c select to test end
427407 update
428408 selection get
429409 } -cleanup {
430 .c delete test
410 .c delete test
431411 } -result "abcd\nefghi\njklmnopq"
432412 test canvText-7.3 {DisplayText procedure: selection} -setup {
433 .c create text 20 20 -tag test
434 focus .c
435 .c focus test
436 } -body {
437 .c itemconfig test -text "abcd\nefghi\njklmnopq"
413 .c create text 20 20 -tag test
414 focus .c
415 .c focus test
416 } -body {
417 .c itemconfig test -text "abcd\nefghi\njklmnopq"
438418 .c select from test 0
439419 .c select to test end
440420 update
441421 selection get
442422 } -cleanup {
443 .c delete test
423 .c delete test
444424 } -result "abcd\nefghi\njklmnopq"
445425 test canvText-7.4 {DisplayText procedure: one line selection} -setup {
446 .c create text 20 20 -tag test
447 focus .c
448 .c focus test
449 } -body {
450 .c itemconfig test -text "abcd\nefghi\njklmnopq"
426 .c create text 20 20 -tag test
427 focus .c
428 .c focus test
429 } -body {
430 .c itemconfig test -text "abcd\nefghi\njklmnopq"
451431 .c select from test 2
452432 .c select to test 3
453433 update
454434 } -cleanup {
455 .c delete test
435 .c delete test
456436 } -result {}
457437 test canvText-7.5 {DisplayText procedure: multi-line selection} -setup {
458 .c create text 20 20 -tag test
459 focus .c
460 .c focus test
461 } -body {
462 .c itemconfig test -text "abcd\nefghi\njklmnopq"
438 .c create text 20 20 -tag test
439 focus .c
440 .c focus test
441 } -body {
442 .c itemconfig test -text "abcd\nefghi\njklmnopq"
463443 .c select from test 2
464444 .c select to test 12
465445 update
466446 } -cleanup {
467 .c delete test
447 .c delete test
468448 } -result {}
469449 test canvText-7.6 {DisplayText procedure: draw cursor} -setup {
470 .c create text 20 20 -tag test
471 focus .c
472 .c focus test
473 } -body {
474 .c itemconfig test -text "abcd\nefghi\njklmnopq"
450 .c create text 20 20 -tag test
451 focus .c
452 .c focus test
453 } -body {
454 .c itemconfig test -text "abcd\nefghi\njklmnopq"
475455 .c icursor test 3
476456 update
477457 } -cleanup {
478 .c delete test
458 .c delete test
479459 } -result {}
480460 test canvText-7.7 {DisplayText procedure: selected text different color} -setup {
481 .c create text 20 20 -tag test
482 .c itemconfig test -text "abcd\nefghi\njklmnopq"
483 focus .c
484 .c focus test
461 .c create text 20 20 -tag test
462 .c itemconfig test -text "abcd\nefghi\njklmnopq"
463 focus .c
464 .c focus test
485465 } -body {
486466 .c config -selectforeground blue
487467 .c itemconfig test -anchor n
488468 update
489469 } -cleanup {
490 .c delete test
470 .c delete test
491471 } -result {}
492472 test canvText-7.8 {DisplayText procedure: not selected} -setup {
493 .c create text 20 20 -tag test
494 .c itemconfig test -text "abcd\nefghi\njklmnopq"
495 focus .c
496 .c focus test
473 .c create text 20 20 -tag test
474 .c itemconfig test -text "abcd\nefghi\njklmnopq"
475 focus .c
476 .c focus test
497477 } -body {
498478 .c select clear
499479 update
500480 } -cleanup {
501 .c delete test
481 .c delete test
502482 } -result {}
503483 test canvText-7.9 {DisplayText procedure: select end} -setup {
504 destroy .t
484 destroy .t
505485 } -body {
506486 toplevel .t
507487 wm geometry .t +0+0
515495 #catch {destroy .t}
516496 update
517497 } -cleanup {
518 destroy .t
498 destroy .t
519499 } -result {}
520500
521501 test canvText-8.1 {TextInsert procedure: 0 length insert} -setup {
522 .c create text 20 20 -tag test
523 .c itemconfig test -text "abcd\nefghi\njklmnopq"
524 focus .c
525 .c focus test
502 .c create text 20 20 -tag test
503 .c itemconfig test -text "abcd\nefghi\njklmnopq"
504 focus .c
505 .c focus test
526506 } -body {
527507 .c insert test end {}
528508 } -cleanup {
529 .c delete test
509 .c delete test
530510 } -result {}
531511 test canvText-8.2 {TextInsert procedure: before beginning/after end} -body {
532512 # Can't test this because GetTextIndex filters out those numbers.
533513 } -result {}
534514 test canvText-8.3 {TextInsert procedure: inserting in a selected item} -setup {
535 .c create text 20 20 -tag test
536 focus .c
537 .c focus test
515 .c create text 20 20 -tag test
516 focus .c
517 .c focus test
538518 } -body {
539519 .c itemconfig test -text "abcdefg"
540520 .c select from test 2
543523 .c itemcget test -text
544524 } -result {axyzbcdefg}
545525 test canvText-8.4 {TextInsert procedure: inserting before selection} -setup {
546 .c create text 20 20 -tag test
547 focus .c
548 .c focus test
526 .c create text 20 20 -tag test
527 focus .c
528 .c focus test
549529 } -body {
550530 .c itemconfig test -text "abcdefg"
551531 .c select from test 2
554534 list [.c index test sel.first] [.c index test sel.last]
555535 } -result {5 7}
556536 test canvText-8.5 {TextInsert procedure: inserting in selection} -setup {
557 .c create text 20 20 -tag test
558 focus .c
559 .c focus test
537 .c create text 20 20 -tag test
538 focus .c
539 .c focus test
560540 } -body {
561541 .c itemconfig test -text "abcdefg"
562542 .c select from test 2
565545 list [.c index test sel.first] [.c index test sel.last]
566546 } -result {2 7}
567547 test canvText-8.6 {TextInsert procedure: inserting after selection} -setup {
568 .c create text 20 20 -tag test
569 focus .c
570 .c focus test
548 .c create text 20 20 -tag test
549 focus .c
550 .c focus test
571551 } -body {
572552 .c itemconfig test -text "abcdefg"
573553 .c select from test 2
576556 list [.c index test sel.first] [.c index test sel.last]
577557 } -result {2 4}
578558 test canvText-8.7 {TextInsert procedure: inserting in unselected item} -setup {
579 .c create text 20 20 -tag test
580 focus .c
581 .c focus test
559 .c create text 20 20 -tag test
560 focus .c
561 .c focus test
582562 } -body {
583563 .c itemconfig test -text "abcdefg"
584564 .c select clear
586566 .c itemcget test -text
587567 } -result {abcdexyzfg}
588568 test canvText-8.8 {TextInsert procedure: inserting before cursor} -setup {
589 .c create text 20 20 -tag test
590 focus .c
591 .c focus test
569 .c create text 20 20 -tag test
570 focus .c
571 .c focus test
592572 } -body {
593573 .c itemconfig test -text "abcdefg"
594574 .c icursor test 3
596576 .c index test insert
597577 } -result {6}
598578 test canvText-8.9 {TextInsert procedure: inserting after cursor} -setup {
599 .c create text 20 20 -tag test
600 focus .c
601 .c focus test
579 .c create text 20 20 -tag test
580 focus .c
581 .c focus test
602582 } -body {
603583 .c itemconfig test -text "abcdefg"
604584 .c icursor test 3
711691
712692
713693 test canvText-10.1 {TextToPoint procedure} -body {
714 .c create text 0 0 -tag test
694 .c create text 0 0 -tag test
715695 .c itemconfig test -text 0 -anchor center
716696 .c index test @0,0
717697 } -cleanup {
720700
721701
722702 test canvText-11.1 {TextToArea procedure} -setup {
723 .c create text 0 0 -tag test
724 focus .c
725 .c focus test
726 } -body {
703 .c create text 0 0 -tag test
704 focus .c
705 .c focus test
706 } -body {
727707 .c itemconfig test -text 0 -anchor center
728 set res1 [.c find overlapping 0 0 1 1]
729 set res2 [.c find withtag test]
730 expr {$res1 eq $res2}
731 } -cleanup {
732 .c delete test
708 set res1 [.c find overlapping 0 0 1 1]
709 set res2 [.c find withtag test]
710 expr {$res1 eq $res2}
711 } -cleanup {
712 .c delete test
733713 } -result 1
734714 test canvText-11.2 {TextToArea procedure} -setup {
735 .c create text 0 0 -tag test
736 focus .c
737 .c focus test
738 } -body {
715 .c create text 0 0 -tag test
716 focus .c
717 .c focus test
718 } -body {
739719 .c itemconfig test -text 0 -anchor center
740720 .c find overlapping 1000 1000 1001 1001
741721 } -cleanup {
744724
745725
746726 test canvText-12.1 {ScaleText procedure} -body {
747 .c create text 100 100 -tag test
727 .c create text 100 100 -tag test
748728 .c scale all 50 50 2 2
749729 format {%.6g %.6g} {*}[.c coords test]
750730 } -cleanup {
762742
763743
764744 test canvText-14.1 {GetTextIndex procedure} -setup {
765 .c create text 0 0 -tag test
766 focus .c
767 .c focus test
768 } -body {
769 .c itemconfig test -text "abcdefghijklmno" -anchor nw
770 .c select from test 5
771 .c select to test 8
772 .c icursor test 12
773 .c coords test 0 0
774
745 .c create text 0 0 -tag test
746 focus .c
747 .c focus test
748 } -body {
749 .c itemconfig test -text "abcdefghijklmno" -anchor nw
750 .c select from test 5
751 .c select to test 8
752 .c icursor test 12
753 .c coords test 0 0
775754 list [.c index test end] [.c index test insert] \
776755 [.c index test sel.first] [.c index test sel.last] \
777756 [.c index test @0,0] \
778757 [.c index test -1] [.c index test 10] [.c index test 100]
779758 } -cleanup {
780 .c delete test
759 .c delete test
781760 } -result {15 12 5 8 0 0 10 15}
782761 test canvText-14.2 {GetTextIndex procedure: select error} -setup {
783 .c create text 0 0 -tag test
784 focus .c
785 .c focus test
786 } -body {
762 .c create text 0 0 -tag test
763 focus .c
764 .c focus test
765 } -body {
787766 .c select clear
788767 .c index test sel.first
789768 } -cleanup {
790 .c delete test
769 .c delete test
791770 } -returnCodes {error} -result {selection isn't in item}
792771 test canvText-14.3 {GetTextIndex procedure: select error} -setup {
793 .c create text 0 0 -tag test
794 focus .c
795 .c focus test
796 } -body {
772 .c create text 0 0 -tag test
773 focus .c
774 .c focus test
775 } -body {
797776 .c select clear
798777 .c index test sel.last
799778 } -cleanup {
800 .c delete test
779 .c delete test
801780 } -returnCodes {error} -result {selection isn't in item}
802781 test canvText-14.4 {GetTextIndex procedure: select error} -setup {
803 .c create text 0 0 -tag test
804 focus .c
805 .c focus test
806 } -body {
782 .c create text 0 0 -tag test
783 focus .c
784 .c focus test
785 } -body {
807786 .c select clear
808787 .c index test sel.
809788 } -cleanup {
810 .c delete test
789 .c delete test
811790 } -returnCodes {error} -result {bad index "sel."}
812791 test canvText-14.5 {GetTextIndex procedure: bad int or unknown index} -setup {
813 .c create text 0 0 -tag test
814 focus .c
815 .c focus test
816 } -body {
792 .c create text 0 0 -tag test
793 focus .c
794 .c focus test
795 } -body {
817796 .c index test xyz
818797 } -cleanup {
819 .c delete test
798 .c delete test
820799 } -returnCodes {error} -result {bad index "xyz"}
821
800 test canvText-14.6 {select clear errors} -setup {
801 .c create text 0 0 -tag test
802 } -body {
803 .c select clear test
804 } -cleanup {
805 .c delete test
806 } -returnCodes error -result "wrong \# args: should be \".c select clear\""
822807
823808 test canvText-15.1 {SetTextCursor procedure} -setup {
824 .c create text 0 0 -tag test
825 focus .c
826 .c focus test
827 } -body {
828 .c itemconfig test -text "abcdefghijklmno" -anchor nw
809 .c create text 0 0 -tag test
810 focus .c
811 .c focus test
812 } -body {
813 .c itemconfig test -text "abcdefghijklmno" -anchor nw
829814 .c itemconfig -text "abcdefg"
830815 .c icursor test 3
831816 .c index test insert
832817 } -cleanup {
833 .c delete test
818 .c delete test
834819 } -result {3}
835820
836
837821 test canvText-16.1 {GetSelText procedure} -setup {
838 .c create text 0 0 -tag test
839 focus .c
840 .c focus test
841 } -body {
822 .c create text 0 0 -tag test
823 focus .c
824 .c focus test
825 } -body {
842826 .c itemconfig test -text "abcdefghijklmno" -anchor nw
843827 .c select from test 5
844828 .c select to test 8
845829 selection get
846830 } -cleanup {
847 .c delete test
831 .c delete test
848832 } -result {fghi}
849
850833
851834 test canvText-17.1 {TextToPostscript procedure} -setup {
852835 .c delete all
853 } -body {
854 set font {Courier 12 italic}
855 set ax [font measure $font 0]
856 set ay [font metrics $font -linespace]
857
858 set result "/Courier-Oblique findfont [font actual $font -size] scalefont ISOEncode setfont
836 set result {/Courier-Oblique findfont [font actual $font -size] scalefont ISOEncode setfont
859837 0.000 0.000 0.000 setrgbcolor AdjustColor
860 100 200 \[
838 0 100 200 \[
861839 \[(000)\]
862840 \[(000)\]
863841 \[(00)\]
864 ] $ay -0.5 0.0 0 false DrawText
842 \] $ay -0.5 0 0 false DrawText
865843 grestore
866844 restore showpage
867845
868846 %%Trailer
869847 end
870848 %%EOF
871 "
849 }
850 } -body {
851 set font {Courier 12 italic}
852 set ax [font measure $font 0]
853 set ay [font metrics $font -linespace]
872854 .c config -height 300 -highlightthickness 0 -bd 0
873855 update
874856 .c create text 100 100 -tags test
876858 .c itemconfig test -anchor n -fill black
877859 set x [.c postscript]
878860 set x [string range $x [string first "/Courier-Oblique" $x] end]
879 expr {$x eq $result}
880 } -result 1
861 expr {$x eq [subst $result] ? "ok" : $x}
862 } -result ok
881863
882864 test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} -setup {
883865 destroy .c
891873 update
892874 .c find enclosed 99 99 [expr $x2 + 1] [expr $y2 + 1]
893875 } -cleanup {
894 destroy .c
895 } -result 1
896
876 destroy .c
877 } -result 1
897878
898879 test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} -setup {
899880 destroy .c
900 } -body {
901881 set c [canvas .c -bg black -width 964]
902882 pack $c
903883 $c delete all
904 after 1000 "set done 1" ; vwait done
905
884 after 100 "set done 1"; vwait done
885 } -body {
906886 set f {Arial 28 bold}
907
908887 set s1 { Yeah-ah-ah-ah-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-Yow}
909888 set s2 { Yeah ah ah ah oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh Yow}
910
911889 $c create text 21 18 \
912890 -font $f \
913891 -text $s1 \
915893 -width 922 \
916894 -anchor nw \
917895 -tags tbox1
918 eval {$c create rect} [$c bbox tbox1] -outline red
919
896 $c create rect {*}[$c bbox tbox1] -outline red
920897 $c create text 21 160 \
921898 -font $f \
922899 -text $s2 \
924901 -width 922 \
925902 -anchor nw \
926903 -tags tbox2
927 eval {$c create rect} [$c bbox tbox2] -outline red
928
929 after 1000 "set done 1" ; vwait done
930
904 $c create rect {*}[$c bbox tbox2] -outline red
905 after 500 "set done 1" ; vwait done
931906 set results [list]
932
933907 $c select from tbox2 4
934908 $c select to tbox2 8
935909 lappend results [selection get]
936
937910 $c select from tbox1 4
938911 $c select to tbox1 8
939912 lappend results [selection get]
940
941913 array set metrics [font metrics $f]
942914 set x [expr {21 + [font measure $f " "] \
943915 + ([font measure {Arial 28 bold} "Y"] / 2)}]
944916 set y1 [expr {18 + ($metrics(-linespace) / 2)}]
945917 set y2 [expr {160 + ($metrics(-linespace) / 2)}]
946
947918 lappend results [$c index tbox1 @$x,$y1]
948919 lappend results [$c index tbox2 @$x,$y2]
949
950 return $results
951 } -cleanup {
952 destroy .c
920 } -cleanup {
921 destroy .c
953922 } -result {{Yeah } Yeah- 4 4}
954923
924 test canvText-20.1 {angled text bounding box} -setup {
925 destroy .c
926 canvas .c
927 proc transpose {bbox} {
928 lassign $bbox a b c d
929 list $b $a $d $c
930 }
931 } -body {
932 .c create text 2 2 -tag t -anchor center -text 0 -font {Helvetica 24}
933 set bb0 [.c bbox t]
934 .c itemconf t -angle 90
935 set bb1 [.c bbox t]
936 .c itemconf t -angle 180
937 set bb2 [.c bbox t]
938 .c itemconf t -angle 270
939 set bb3 [.c bbox t]
940 list [expr {$bb0 eq $bb2 ? "ok" : "$bb0,$bb2"}] \
941 [expr {$bb1 eq $bb3 ? "ok" : "$bb1,$bb3"}] \
942 [expr {$bb0 eq [transpose $bb1] ? "ok" : "$bb0,$bb1"}] \
943 } -cleanup {
944 destroy .c
945 rename transpose {}
946 } -result {ok ok ok}
955947
956948 # cleanup
957949 cleanupTests
958950 return
959
960
961
0 # This file is a Tcl script to test out the procedures in tkCanvas.c,
1 # which implements generic code for canvases. It is organized in the
2 # standard fashion for Tcl tests.
0 # This file is a Tcl script to test out the procedures in tkCanvas.c, which
1 # implements generic code for canvases. It is organized in the standard
2 # fashion for Tcl tests.
33 #
44 # Copyright (c) 1995-1996 Sun Microsystems, Inc.
55 # Copyright (c) 1998-2000 Ajuba Solutions.
6 # Copyright (c) 2008 Donal K. Fellows
67 # All rights reserved.
78 #
8 # RCS: @(#) $Id: canvas.test,v 1.25 2008/08/08 17:46:38 aniap Exp $
9 # RCS: @(#) $Id: canvas.test,v 1.28 2008/12/12 00:09:38 nijtmans Exp $
910
1011 package require tcltest 2.1
1112 eval tcltest::configure $argv
1213 tcltest::loadTestedCommands
1314
14 # XXX - This test file is woefully incomplete. At present, only a
15 # few of the features are tested.
15 # XXX - This test file is woefully incomplete. At present, only a few of the
16 # features are tested.
1617
1718 # Canvas used in 1.* test cases
1819 canvas .c
1920 pack .c
2021 update
22
2123 test canvas-1.1 {configuration options: good value for "background"} -body {
2224 .c configure -background #ff0000
2325 .c cget -background
2527 test canvas-1.2 {configuration options: bad value for "background"} -body {
2628 .c configure -background non-existent
2729 } -returnCodes error -result {unknown color name "non-existent"}
28
2930 test canvas-1.3 {configuration options: good value for "bg"} -body {
3031 .c configure -bg #ff0000
3132 .c cget -bg
3334 test canvas-1.4 {configuration options: bad value for "bg"} -body {
3435 .c configure -bg non-existent
3536 } -returnCodes error -result {unknown color name "non-existent"}
36
3737 test canvas-1.5 {configuration options: good value for "bd"} -body {
3838 .c configure -bd 4
3939 .c cget -bd
4141 test canvas-1.6 {configuration options: bad value for "bd"} -body {
4242 .c configure -bd badValue
4343 } -returnCodes error -result {bad screen distance "badValue"}
44
4544 test canvas-1.7 {configuration options: good value for "borderwidth"} -body {
4645 .c configure -borderwidth 1.3
4746 .c cget -borderwidth
4948 test canvas-1.8 {configuration options: bad value for "borderwidth"} -body {
5049 .c configure -borderwidth badValue
5150 } -returnCodes error -result {bad screen distance "badValue"}
52
5351 test canvas-1.9 {configuration options: good value for "closeenough"} -body {
5452 .c configure -closeenough 24
5553 .c cget -closeenough
5755 test canvas-1.10 {configuration options: bad value for "closeenough"} -body {
5856 .c configure -closeenough bogus
5957 } -returnCodes error -result {expected floating-point number but got "bogus"}
60
6158 test canvas-1.11 {configuration options: good value for "confine"} -body {
6259 .c configure -confine true
6360 .c cget -confine
6562 test canvas-1.12 {configuration options: bad value for "confine"} -body {
6663 .c configure -confine silly
6764 } -returnCodes error -result {expected boolean value but got "silly"}
68
6965 test canvas-1.13 {configuration options: good value for "cursor"} -body {
7066 .c configure -cursor arrow
7167 .c cget -cursor
7369 test canvas-1.14 {configuration options: bad value for "cursor"} -body {
7470 .c configure -cursor badValue
7571 } -returnCodes error -result {bad cursor spec "badValue"}
76
7772 test canvas-1.15 {configuration options: good value for "height"} -body {
7873 .c configure -height 2.1
7974 .c cget -height
8176 test canvas-1.16 {configuration options: bad value for "height"} -body {
8277 .c configure -height x42
8378 } -returnCodes error -result {bad screen distance "x42"}
84
8579 test canvas-1.17 {configuration options: good value for "highlightbackground"} -body {
8680 .c configure -highlightbackground #112233
8781 .c cget -highlightbackground
8983 test canvas-1.18 {configuration options: bad value for "highlightbackground"} -body {
9084 .c configure -highlightbackground ugly
9185 } -returnCodes error -result {unknown color name "ugly"}
92
9386 test canvas-1.19 {configuration options: good value for "highlightcolor"} -body {
9487 .c configure -highlightcolor #110022
9588 .c cget -highlightcolor
9790 test canvas-1.20 {configuration options: bad value for "highlightcolor"} -body {
9891 .c configure -highlightcolor bogus
9992 } -returnCodes error -result {unknown color name "bogus"}
100
10193 test canvas-1.21 {configuration options: good value for "highlightthickness"} -body {
10294 .c configure -highlightthickness 18
10395 .c cget -highlightthickness
10597 test canvas-1.22 {configuration options: bad value for "highlightthickness"} -body {
10698 .c configure -highlightthickness badValue
10799 } -returnCodes error -result {bad screen distance "badValue"}
108
109100 test canvas-1.23 {configuration options: good value for "insertbackground"} -body {
110101 .c configure -insertbackground #110022
111102 .c cget -insertbackground
113104 test canvas-1.24 {configuration options: bad value for "insertbackground"} -body {
114105 .c configure -insertbackground bogus
115106 } -returnCodes error -result {unknown color name "bogus"}
116
117107 test canvas-1.25 {configuration options: good value for "insertborderwidth"} -body {
118108 .c configure -insertborderwidth 1.3
119109 .c cget -insertborderwidth
121111 test canvas-1.26 {configuration options: bad value for "insertborderwidth"} -body {
122112 .c configure -insertborderwidth 2.6x
123113 } -returnCodes error -result {bad screen distance "2.6x"}
124
125114 test canvas-1.27 {configuration options: good value for "insertofftime"} -body {
126115 .c configure -insertofftime 100
127116 .c cget -insertofftime
129118 test canvas-1.28 {configuration options: bad value for "insertofftime"} -body {
130119 .c configure -insertofftime 3.2
131120 } -returnCodes error -result {expected integer but got "3.2"}
132
133121 test canvas-1.29 {configuration options: good value for "insertontime"} -body {
134122 .c configure -insertontime 100
135123 .c cget -insertontime
137125 test canvas-1.30 {configuration options: bad value for "insertontime"} -body {
138126 .c configure -insertontime 3.2
139127 } -returnCodes error -result {expected integer but got "3.2"}
140
141128 test canvas-1.31 {configuration options: good value for "insertwidth"} -body {
142129 .c configure -insertwidth 1.3
143130 .c cget -insertwidth
145132 test canvas-1.32 {configuration options: bad value for "insertwidth"} -body {
146133 .c configure -insertwidth 6x
147134 } -returnCodes error -result {bad screen distance "6x"}
148
149135 test canvas-1.33 {configuration options: good value for "relief"} -body {
150136 .c configure -relief groove
151137 .c cget -relief
152138 } -result {groove}
153139 test canvas-1.34 {configuration options: bad value for "relief"} -body {
154140 .c configure -relief 1.5
155 } -returnCodes error -result {bad relief type "1.5": must be flat, groove, raised, ridge, solid, or sunken}
156
141 } -returnCodes error -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}
157142 test canvas-1.35 {configuration options: good value for "selectbackground"} -body {
158143 .c configure -selectbackground #110022
159144 .c cget -selectbackground
161146 test canvas-1.36 {configuration options: bad value for "selectbackground"} -body {
162147 .c configure -selectbackground bogus
163148 } -returnCodes error -result {unknown color name "bogus"}
164
165149 test canvas-1.37 {configuration options: good value for "selectborderwidth"} -body {
166150 .c configure -selectborderwidth 1.3
167151 .c cget -selectborderwidth
169153 test canvas-1.38 {configuration options: bad value for "selectborderwidth"} -body {
170154 .c configure -selectborderwidth badValue
171155 } -returnCodes error -result {bad screen distance "badValue"}
172
173156 test canvas-1.39 {configuration options: good value for "selectforeground"} -body {
174157 .c configure -selectforeground #654321
175158 .c cget -selectforeground
177160 test canvas-1.40 {configuration options: bad value for "selectforeground"} -body {
178161 .c configure -selectforeground bogus
179162 } -returnCodes error -result {unknown color name "bogus"}
180
181163 test canvas-1.41 {configuration options: good value for "takefocus"} -body {
182164 .c configure -takefocus "any string"
183165 .c cget -takefocus
184166 } -result {any string}
185
186167 test canvas-1.42 {configuration options: good value for "width"} -body {
187168 .c configure -width 402
188169 .c cget -width
190171 test canvas-1.43 {configuration options: bad value for "width"} -body {
191172 .c configure -width xyz
192173 } -returnCodes error -result {bad screen distance "xyz"}
193
194174 test canvas-1.44 {configuration options: good value for "xscrollcommand"} -body {
195175 .c configure -xscrollcommand {Some command}
196176 .c cget -xscrollcommand
197177 } -result {Some command}
198
199178 test canvas-1.45 {configuration options: good value for "yscrollcommand"} -body {
200179 .c configure -yscrollcommand {Another command}
201180 .c cget -yscrollcommand
202181 } -result {Another command}
203
204182 test canvas-1.46 {configure throws error on bad option} -body {
205183 .c configure -gorp foo
206184 } -returnCodes error -match glob -result {*}
211189 } -returnCodes error -match glob -result {*}
212190 catch {destroy .c}
213191
214
215192 # Canvas used in 2.* test cases
216193 canvas .c -width 60 -height 40 -scrollregion {0 0 200 150} -bd 0 \
217194 -highlightthickness 0
218195 pack .c
219196 update
197
220198 test canvas-2.1 {CanvasWidgetCmd, bind option} -body {
221199 set i [.c create rect 10 10 100 100]
222200 .c bind $i <a>
223201 } -cleanup {
224 .c delete $i
202 .c delete $i
225203 } -returnCodes ok
226204 test canvas-2.2 {CanvasWidgetCmd, bind option} -body {
227205 set i [.c create rect 10 10 100 100]
228206 .c bind $i <
229207 } -cleanup {
230 .c delete $i
208 .c delete $i
231209 } -returnCodes error -result {no event type or button # or keysym}
232210 test canvas-2.3 {CanvasWidgetCmd, xview option} -body {
233211 .c configure -xscrollincrement 40 -yscrollincrement 5
239217 lappend x [.c xview]
240218 } -result {{0.0 0.3} {0.4 0.7}}
241219 test canvas-2.4 {CanvasWidgetCmd, xview option} -constraints nonPortable -body {
242 # This test gives slightly different results on platforms such
243 # as NetBSD. I don't know why...
220 # This test gives slightly different results on platforms such as NetBSD.
221 # I don't know why...
244222 .c configure -xscrollincrement 0 -yscrollincrement 5
245223 .c xview moveto 0.6
246224 update
251229 } -result {{0.6 0.9} {0.66 0.96}}
252230 catch {destroy .c}
253231
254
255232 # Canvas used in 3.* test cases
256233 canvas .c -width 60 -height 40 -scrollregion {0 0 200 80} \
257234 -borderwidth 0 -highlightthickness 0
258235 pack .c
259236 update
237
260238 test canvas-3.1 {CanvasWidgetCmd, yview option} -body {
261239 .c configure -xscrollincrement 40 -yscrollincrement 5
262240 .c yview moveto 0
277255 } -result {{0.0 0.5} {0.1 0.6}}
278256 destroy .c
279257
280
281258 test canvas-4.1 {ButtonEventProc procedure} -setup {
282259 deleteWindows
283 set x {}
260 set x {}
284261 } -body {
285262 canvas .c1 -bg #543210
286263 rename .c1 .c2
295272 rename .c1 {}
296273 list [info command .c*] [winfo children .]
297274 } -cleanup {
298 destroy .c1
275 destroy .c1
299276 } -result {{} {}}
300
301277
302278 # Canvas used in 6.* test cases
303279 canvas .c -width 100 -height 50 -scrollregion {-200 -100 305 102} \
304280 -borderwidth 2 -highlightthickness 3
305281 pack .c
306282 update
283
307284 test canvas-6.1 {CanvasSetOrigin procedure} -body {
308285 .c configure -xscrollincrement 0 -yscrollincrement 0
309286 .c xview moveto 0
315292 .c configure -xscrollincrement 20 -yscrollincrement 10
316293 set x ""
317294 foreach i {.08 .10 .48 .50} {
318 .c xview moveto $i
319 update
320 lappend x [.c canvasx 0]
295 .c xview moveto $i
296 update
297 lappend x [.c canvasx 0]
321298 }
322299 return $x
323300 } -result {-165.0 -145.0 35.0 55.0}
343320 } -result {55.0}
344321 deleteWindows
345322
346
347323 test canvas-7.1 {canvas widget vs hidden commands} -setup {
348324 canvas .c
349325 } -body {
350 set l [lsort [interp hidden]]
351326 interp hide {} .c
352327 destroy .c
353 set result [list [winfo children .] [lsort [interp hidden]]]
354 expr {$result eq [list {} $l]}
355 } -cleanup {
356 destroy .c
357 } -result {1}
358
328 list [winfo children .] [lsort [interp hidden]]
329 } -cleanup {
330 destroy .c
331 } -result [list {} [lsort [interp hidden]]]
359332
360333 test canvas-8.1 {canvas arc bbox} -setup {
361334 catch {destroy .c}
370343 list $arcBox $coordBox $pieBox
371344 } -result {{48 21 100 94} {248 21 300 94} {398 21 500 112}}
372345
373
374346 test canvas-9.1 {canvas id creation and deletion} -setup {
375347 catch {destroy .c}
376348 canvas .c
377349 } -body {
378 # With Tk 8.0.4 the ids are now stored in a hash table. You
379 # can use this test as a performance test with older versions
380 # by changing the value of size.
350 # With Tk 8.0.4 the ids are now stored in a hash table. You can use this
351 # test as a performance test with older versions by changing the value of
352 # size.
381353 set size 15
382
383354 for {set i 0} {$i < $size} {incr i} {
384 set x [expr {-10 + 3*$i}]
385 for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
386 .c create rect ${x}c ${y}c [expr $x+2]c [expr $y+2]c \
387 -outline black -fill blue -tags rect
388 .c create text [expr $x+1]c [expr $y+1]c -text "$i,$j" \
389 -anchor center -tags text
390 }
355 set x [expr {-10 + 3*$i}]
356 for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
357 .c create rect ${x}c ${y}c [expr $x+2]c [expr $y+2]c \
358 -outline black -fill blue -tags rect
359 .c create text [expr $x+1]c [expr $y+1]c -text "$i,$j" \
360 -anchor center -tags text
361 }
391362 }
392
393 # The actual bench mark - this code also exercises all the hash
394 # table changes.
395
363 # The actual bench mark - this code also exercises all the hash table
364 # changes.
396365 set time [lindex [time {
397366 foreach id [.c find withtag all] {
398367 .c lower $id
402371 .c delete $id
403372 }
404373 }] 0]
405
406374 set x ""
407375 } -result {}
408376
409
410377 test canvas-10.1 {find items using tag expressions} -setup {
411378 catch {destroy .c}
412379 canvas .c
380 set res {}
413381 } -body {
414382 .c create oval 20 20 40 40 -fill red -tag [list a b c d]
415383 .c create oval 20 60 40 80 -fill yellow -tag [list b a]
418386 .c create oval 20 180 40 200 -fill bisque -tag [list a d e]
419387 .c create oval 20 220 40 240 -fill bisque -tag b
420388 .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
421 set res {}
422389 lappend res [.c find withtag {!a}]
423390 lappend res [.c find withtag {b&&c}]
424391 lappend res [.c find withtag {b||c}]
485452 canvas .c
486453 .c create oval 20 20 40 40 -fill red -tag [list a b c d]
487454 .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
488 } -body {
455 } -returnCodes error -body {
489456 .c find withtag {a&&"tag with spaces"z}
490 } -returnCodes error -result {Invalid boolean operator in tag search expression}
457 } -result {Invalid boolean operator in tag search expression}
491458 test canvas-10.9 {check errors from tag expressions} -setup {
492459 catch {destroy .c}
493460 canvas .c
507474 test canvas-10.11 {backward compatility - strange tags that are not expressions} -setup {
508475 catch {destroy .c}
509476 canvas .c
510 .c create oval 20 20 40 40 -fill red -tag [list { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }]
477 .c create oval 20 20 40 40 -fill red \
478 -tag [list { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }]
511479 } -body {
512480 .c find withtag { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }
513481 } -result 1
518486 .c bind {a && b} <Enter> {puts Enter}
519487 .c bind {a && b} <Leave> {puts Leave}
520488 } -result {}
521
522489
523490 test canvas-11.1 {canvas poly fill check, bug 5783} -setup {
524491 destroy .c
534501 set result {}
535502 } -body {
536503 .c create poly 30 30 90 90 30 90 90 30
537 lappend result [.c find over 40 40 45 45]; # rect region inc. edge
538 lappend result [.c find over 60 40 60 40]; # top-center point
539 lappend result [.c find over 0 0 0 0]; # not on poly
540 lappend result [.c find over 60 60 60 60]; # center-point
541 lappend result [.c find over 45 50 45 50]; # outside poly
504 lappend result [.c find over 40 40 45 45]; # rect region inc. edge
505 lappend result [.c find over 60 40 60 40]; # top-center point
506 lappend result [.c find over 0 0 0 0]; # not on poly
507 lappend result [.c find over 60 60 60 60]; # center-point
508 lappend result [.c find over 45 50 45 50]; # outside poly
542509 .c itemconfig 1 -fill "" -outline black
543 lappend result [.c find over 40 40 45 45]; # rect region inc. edge
544 lappend result [.c find over 60 40 60 40]; # top-center point
545 lappend result [.c find over 0 0 0 0]; # not on poly
546 lappend result [.c find over 60 60 60 60]; # center-point
547 lappend result [.c find over 45 50 45 50]; # outside poly
510 lappend result [.c find over 40 40 45 45]; # rect region inc. edge
511 lappend result [.c find over 60 40 60 40]; # top-center point
512 lappend result [.c find over 0 0 0 0]; # not on poly
513 lappend result [.c find over 60 60 60 60]; # center-point
514 lappend result [.c find over 45 50 45 50]; # outside poly
548515 .c itemconfig 1 -width 8
549 lappend result [.c find over 45 50 45 50]; # outside poly
516 lappend result [.c find over 45 50 45 50]; # outside poly
550517 } -result {1 1 {} 1 {} 1 1 {} 1 {} 1}
551
552518
553519 test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} -setup {
554520 destroy .c
580546 $w create rectangle 80 80 120 120 -fill blue -tags blue
581547 # bind a button press to re-build the canvas
582548 $w bind blue <ButtonRelease-1> [subst {
583 [lindex [info level 0] 0] $w
584 append ::x ok
585 }
586 ]
549 [lindex [info level 0] 0] $w
550 append ::x ok
551 }]
587552 }
588553 test canvas-13.1 {canvas delete during event, SF bug-228024} -body {
589554 kill_canvas .c
590555 set ::x {}
591556 # do this many times to improve chances of triggering the crash
592557 for {set i 0} {$i < 30} {incr i} {
593 event generate .c <1> -x 100 -y 100
594 event generate .c <ButtonRelease-1> -x 100 -y 100
558 event generate .c <1> -x 100 -y 100
559 event generate .c <ButtonRelease-1> -x 100 -y 100
595560 }
596561 return $::x
597562 } -result {okokokokokokokokokokokokokokokokokokokokokokokokokokokokokok}
598563
599
600564 test canvas-14.1 {canvas scan SF bug 581560} -setup {
601565 destroy .c
602566 canvas .c
603 } -body {
567 } -returnCodes error -body {
604568 .c scan
605 } -returnCodes error -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
569 } -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
606570 test canvas-14.2 {canvas scan} -setup {
607571 destroy .c
608572 canvas .c
609 } -body {
573 } -returnCodes error -body {
610574 .c scan bogus
611 } -returnCodes error -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
575 } -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
612576 test canvas-14.3 {canvas scan} -setup {
613577 destroy .c
614578 canvas .c
615 } -body {
579 } -returnCodes error -body {
616580 .c scan mark
617 } -returnCodes error -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
581 } -result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"}
618582 test canvas-14.4 {canvas scan} -setup {
619583 destroy .c
620584 canvas .c
634598 .c scan dragto 10 10 5
635599 } -result {}
636600
637
638601 test canvas-15.1 {basic types check: arc requires coords} -setup {
639 destroy .c
640 canvas .c
641 } -body {
642 .c create arc
643 } -returnCodes error -result {wrong # args: should be ".c create arc coords ?arg ...?"}
602 destroy .c
603 canvas .c
604 } -returnCodes error -body {
605 .c create arc
606 } -result {wrong # args: should be ".c create arc coords ?arg ...?"}
644607 test canvas-15.2 "basic coords check: arc coords are paired" -setup {
645 destroy .c
646 canvas .c
647 } -body {
648 .c create arc 0
608 destroy .c
609 canvas .c
610 } -body {
611 .c create arc 0
649612 } -returnCodes error -result {wrong # coordinates: expected 4, got 1}
650
651613 test canvas-15.3 {basic types check: bitmap requires coords} -setup {
652 destroy .c
653 canvas .c
654 } -body {
655 .c create bitmap
656 } -returnCodes error -result {wrong # args: should be ".c create bitmap coords ?arg ...?"}
614 destroy .c
615 canvas .c
616 } -returnCodes error -body {
617 .c create bitmap
618 } -result {wrong # args: should be ".c create bitmap coords ?arg ...?"}
657619 test canvas-15.4 "basic coords check: bitmap coords are paired" -setup {
658 destroy .c
659 canvas .c
660 } -body {
661 .c create bitmap 0
620 destroy .c
621 canvas .c
622 } -body {
623 .c create bitmap 0
662624 } -returnCodes error -result {wrong # coordinates: expected 2, got 1}
663
664625 test canvas-15.5 {basic types check: image requires coords} -setup {
665 destroy .c
666 canvas .c
667 } -body {
668 .c create image
669 } -returnCodes error -result {wrong # args: should be ".c create image coords ?arg ...?"}
626 destroy .c
627 canvas .c
628 } -returnCodes error -body {
629 .c create image
630 } -result {wrong # args: should be ".c create image coords ?arg ...?"}
670631 test canvas-15.6 "basic coords check: image coords are paired" -setup {
671 destroy .c
672 canvas .c
673 } -body {
674 .c create image 0
675 } -returnCodes error -result {wrong # coordinates: expected 2, got 1}
676
632 destroy .c
633 canvas .c
634 } -returnCodes error -body {
635 .c create image 0
636 } -result {wrong # coordinates: expected 2, got 1}
677637 test canvas-15.7 {basic types check: line requires coords} -setup {
678 destroy .c
679 canvas .c
680 } -body {
681 .c create line
682 } -returnCodes error -result {wrong # args: should be ".c create line coords ?arg ...?"}
638 destroy .c
639 canvas .c
640 } -returnCodes error -body {
641 .c create line
642 } -result {wrong # args: should be ".c create line coords ?arg ...?"}
683643 test canvas-15.8 "basic coords check: line coords are paired" -setup {
684 destroy .c
685 canvas .c
686 } -body {
687 .c create line 0
688 } -returnCodes error -result {wrong # coordinates: expected an even number, got 1}
689
644 destroy .c
645 canvas .c
646 } -returnCodes error -body {
647 .c create line 0
648 } -result {wrong # coordinates: expected an even number, got 1}
690649 test canvas-15.9 {basic types check: oval requires coords} -setup {
691 destroy .c
692 canvas .c
693 } -body {
694 .c create oval
695 } -returnCodes error -result {wrong # args: should be ".c create oval coords ?arg ...?"}
650 destroy .c
651 canvas .c
652 } -returnCodes error -body {
653 .c create oval
654 } -result {wrong # args: should be ".c create oval coords ?arg ...?"}
696655 test canvas-15.10 "basic coords check: oval coords are paired" -setup {
697 destroy .c
698 canvas .c
699 } -body {
700 .c create oval 0
701 } -returnCodes error -result {wrong # coordinates: expected 0 or 4, got 1}
702
656 destroy .c
657 canvas .c
658 } -returnCodes error -body {
659 .c create oval 0
660 } -result {wrong # coordinates: expected 0 or 4, got 1}
703661 test canvas-15.11 {basic types check: polygon requires coords} -setup {
704 destroy .c
705 canvas .c
706 } -body {
707 .c create polygon
708 } -returnCodes error -result {wrong # args: should be ".c create polygon coords ?arg ...?"}
662 destroy .c
663 canvas .c
664 } -returnCodes error -body {
665 .c create polygon
666 } -result {wrong # args: should be ".c create polygon coords ?arg ...?"}
709667 test canvas-15.12 "basic coords check: polygon coords are paired" -setup {
710 destroy .c
711 canvas .c
712 } -body {
713 .c create polygon 0
714 } -returnCodes error -result {wrong # coordinates: expected an even number, got 1}
715
668 destroy .c
669 canvas .c
670 } -returnCodes error -body {
671 .c create polygon 0
672 } -result {wrong # coordinates: expected an even number, got 1}
716673 test canvas-15.13 {basic types check: rect requires coords} -setup {
717 destroy .c
718 canvas .c
719 } -body {
720 .c create rect
721 } -returnCodes error -result {wrong # args: should be ".c create rect coords ?arg ...?"}
674 destroy .c
675 canvas .c
676 } -returnCodes error -body {
677 .c create rect
678 } -result {wrong # args: should be ".c create rect coords ?arg ...?"}
722679 test canvas-15.14 "basic coords check: rect coords are paired" -setup {
723 destroy .c
724 canvas .c
725 } -body {
726 .c create rect 0
727 } -returnCodes error -result {wrong # coordinates: expected 0 or 4, got 1}
728
680 destroy .c
681 canvas .c
682 } -returnCodes error -body {
683 .c create rect 0
684 } -result {wrong # coordinates: expected 0 or 4, got 1}
729685 test canvas-15.15 {basic types check: text requires coords} -setup {
730 destroy .c
731 canvas .c
732 } -body {
733 .c create text
734 } -returnCodes error -result {wrong # args: should be ".c create text coords ?arg ...?"}
686 destroy .c
687 canvas .c
688 } -returnCodes error -body {
689 .c create text
690 } -result {wrong # args: should be ".c create text coords ?arg ...?"}
735691 test canvas-15.16 "basic coords check: text coords are paired" -setup {
736 destroy .c
737 canvas .c
738 } -body {
739 .c create text 0
740 } -returnCodes error -result {wrong # coordinates: expected 2, got 1}
741
692 destroy .c
693 canvas .c
694 } -returnCodes error -body {
695 .c create text 0
696 } -result {wrong # coordinates: expected 2, got 1}
742697 test canvas-15.17 {basic types check: window requires coords} -setup {
743 destroy .c
744 canvas .c
745 } -body {
746 .c create window
747 } -returnCodes error -result {wrong # args: should be ".c create window coords ?arg ...?"}
698 destroy .c
699 canvas .c
700 } -returnCodes error -body {
701 .c create window
702 } -result {wrong # args: should be ".c create window coords ?arg ...?"}
748703 test canvas-15.18 "basic coords check: window coords are paired" -setup {
749 destroy .c
750 canvas .c
751 } -body {
752 .c create window 0
753 } -returnCodes error -result {wrong # coordinates: expected 2, got 1}
754
704 destroy .c
705 canvas .c
706 } -returnCodes error -body {
707 .c create window 0
708 } -result {wrong # coordinates: expected 2, got 1}
709 test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setup {
710 destroy .c
711 canvas .c
712 } -body {
713 set id [.c create rect 0 0 1cm 1cm]
714 expr {[lindex [.c coords $id] 2]>1}
715 } -result {1}
716 destroy .c
755717
756718 test canvas-16.1 {arc coords check} -setup {
757 destroy .c
758719 canvas .c
759720 } -body {
760721 set id [.c create arc {0 10 20 30} -start 33]
761722 .c itemcget $id -start
723 } -cleanup {
724 destroy .c
762725 } -result {33.0}
763726
764
765727 test canvas-17.1 {default smooth method handling} -setup {
766 destroy .c
767728 canvas .c
768729 } -body {
769730 set id [.c create line {0 0 1 1 2 2 3 3 4 4 5 5 6 6}]
773734 lappend result [.c itemcget $id -smooth]
774735 }
775736 return $result
737 } -cleanup {
738 destroy .c
776739 } -result {0 true true true raw raw true}
777740
778 destroy .c
741 test canvas-18.1 {imove method - lines} -setup {
742 canvas .c
743 } -body {
744 set id [.c create line 0 0 1 1 2 2 3 3]
745 .c imove $id 0 4 4
746 .c coords $id
747 } -cleanup {
748 destroy .c
749 } -result {4.0 4.0 1.0 1.0 2.0 2.0 3.0 3.0}
750 test canvas-18.2 {imove method - lines} -setup {
751 canvas .c
752 } -body {
753 set id [.c create line 0 0 1 1]
754 .c imove $id 0 4 4
755 .c coords $id
756 } -cleanup {
757 destroy .c
758 } -result {4.0 4.0 1.0 1.0}
759 test canvas-18.3 {imove method - lines} -setup {
760 canvas .c
761 } -body {
762 set id [.c create line 0 0 1 1 2 2 3 3]
763 .c imove $id @1,1 4 4
764 .c coords $id
765 } -cleanup {
766 destroy .c
767 } -result {0.0 0.0 4.0 4.0 2.0 2.0 3.0 3.0}
768 test canvas-18.4 {imove method - lines} -constraints knownBug -setup {
769 canvas .c
770 } -body {
771 set id [.c create line 0 0 1 1 2 2 3 3]
772 .c imove $id end 4 4
773 .c coords $id
774 } -cleanup {
775 destroy .c
776 } -result {0.0 0.0 1.0 1.0 2.0 2.0 4.0 4.0}
777 test canvas-18.5 {imove method - polygon} -setup {
778 canvas .c
779 } -body {
780 set id [.c create polygon 0 0 1 1 2 2 3 3]
781 .c imove $id 0 4 4
782 .c coords $id
783 } -cleanup {
784 destroy .c
785 } -result {4.0 4.0 1.0 1.0 2.0 2.0 3.0 3.0}
786 test canvas-18.6 {imove method - polygon} -setup {
787 canvas .c
788 } -body {
789 set id [.c create polygon 0 0 1 1]
790 .c imove $id 0 4 4
791 .c coords $id
792 } -cleanup {
793 destroy .c
794 } -result {4.0 4.0 1.0 1.0}
795 test canvas-18.7 {imove method - polygon} -setup {
796 canvas .c
797 } -body {
798 set id [.c create polygon 0 0 1 1 2 2 3 3]
799 .c imove $id @1,1 4 4
800 .c coords $id
801 } -cleanup {
802 destroy .c
803 } -result {0.0 0.0 4.0 4.0 2.0 2.0 3.0 3.0}
804 test canvas-18.8 {imove method - polygon} -constraints knownBug -setup {
805 canvas .c
806 } -body {
807 set id [.c create polygon 0 0 1 1 2 2 3 3]
808 .c imove $id end 4 4
809 .c coords $id
810 } -cleanup {
811 destroy .c
812 } -result {0.0 0.0 1.0 1.0 2.0 2.0 4.0 4.0}
813 test canvas-18.9 {imove method - errors} -setup {
814 canvas .c
815 } -body {
816 set id [.c create line 0 0 1 1 2 2 3 3]
817 .c imove $id foobar 4 4
818 } -cleanup {
819 destroy .c
820 } -returnCodes error -result {bad index "foobar"}
821 test canvas-18.10 {imove method - errors} -setup {
822 canvas .c
823 } -body {
824 set id [.c create line 0 0 1 1 2 2 3 3]
825 .c imove $id 0 foobar 4
826 } -cleanup {
827 destroy .c
828 } -returnCodes error -result {bad screen distance "foobar"}
829 test canvas-18.11 {imove method - errors} -setup {
830 canvas .c
831 } -body {
832 set id [.c create line 0 0 1 1 2 2 3 3]
833 .c imove $id 0 4 foobar
834 } -cleanup {
835 destroy .c
836 } -returnCodes error -result {bad screen distance "foobar"}
837
838 test canvas-19.1 {rchars method - lines} -setup {
839 canvas .c
840 } -body {
841 set id [.c create line 0 0 1 1 2 2 3 3]
842 .c rchars $id 2 4 {4 4}
843 .c coords $id
844 } -cleanup {
845 destroy .c
846 } -result {0.0 0.0 4.0 4.0 3.0 3.0}
847 test canvas-19.2 {rchars method - lines} -setup {
848 canvas .c
849 } -body {
850 set id [.c create line 0 0 1 1 2 2 3 3]
851 .c rchars $id 2 4 {}
852 .c coords $id
853 } -cleanup {
854 destroy .c
855 } -result {0.0 0.0 3.0 3.0}
856 test canvas-19.3 {rchars method - lines} -setup {
857 canvas .c
858 } -body {
859 set id [.c create line 0 0 1 1 2 2 3 3]
860 .c rchars $id 2 4 {10 11 12 13 14 15}
861 .c coords $id
862 } -cleanup {
863 destroy .c
864 } -result {0.0 0.0 10.0 11.0 12.0 13.0 14.0 15.0 3.0 3.0}
865 test canvas-19.4 {rchars method - polygon} -setup {
866 canvas .c
867 } -body {
868 set id [.c create polygon 0 0 1 1 2 2 3 3]
869 .c rchars $id 2 4 {4 4}
870 .c coords $id
871 } -cleanup {
872 destroy .c
873 } -result {0.0 0.0 4.0 4.0 3.0 3.0}
874 test canvas-19.5 {rchars method - polygon} -setup {
875 canvas .c
876 } -body {
877 set id [.c create polygon 0 0 1 1 2 2 3 3]
878 .c rchars $id 2 4 {}
879 .c coords $id
880 } -cleanup {
881 destroy .c
882 } -result {0.0 0.0 3.0 3.0}
883 test canvas-19.6 {rchars method - polygon} -setup {
884 canvas .c
885 } -body {
886 set id [.c create polygon 0 0 1 1 2 2 3 3]
887 .c rchars $id 2 4 {10 11 12 13 14 15}
888 .c coords $id
889 } -cleanup {
890 destroy .c
891 } -result {0.0 0.0 10.0 11.0 12.0 13.0 14.0 15.0 3.0 3.0}
892 test canvas-19.7 {rchars method - text} -setup {
893 canvas .c
894 } -body {
895 set id [.c create text 0 0 -text abcde]
896 .c rchars $id 1 3 XYZ
897 .c itemcget $id -text
898 } -cleanup {
899 destroy .c
900 } -result aXYZe
901 test canvas-19.8 {rchars method - text} -setup {
902 canvas .c
903 } -body {
904 set id [.c create text 0 0 -text abcde]
905 .c rchars $id 1 3 {}
906 .c itemcget $id -text
907 } -cleanup {
908 destroy .c
909 } -result ae
910 test canvas-19.9 {rchars method - text} -setup {
911 canvas .c
912 } -body {
913 set id [.c create text 0 0 -text abcde]
914 .c rchars $id 1 3 FOOBAR
915 .c itemcget $id -text
916 } -cleanup {
917 destroy .c
918 } -result aFOOBARe
919 test canvas-19.10 {rchars method - errors} -setup {
920 canvas .c
921 } -body {
922 set id [.c create line 0 0 1 1]
923 .c rchars $id foo 1 {2 2}
924 } -cleanup {
925 destroy .c
926 } -returnCodes error -result {bad index "foo"}
927 test canvas-19.11 {rchars method - errors} -setup {
928 canvas .c
929 } -body {
930 set id [.c create line 0 0 1 1]
931 .c rchars $id 1 foo {2 2}
932 } -cleanup {
933 destroy .c
934 } -returnCodes error -result {bad index "foo"}
779935
780936 # cleanup
781937 cleanupTests
782938 return
783939
784
785
786
940 # Local Variables:
941 # mode: tcl
942 # End:
44 # Copyright (c) 1998-1999 by Scriptics Corporation.
55 # All rights reserved.
66 #
7 # RCS: @(#) $Id: clrpick.test,v 1.14 2008/08/15 01:10:03 aniap Exp $
7 # RCS: @(#) $Id: clrpick.test,v 1.15 2008/12/19 15:33:40 dgp Exp $
88 #
99
1010 package require tcltest 2.2
5353 test clrpick-1.2 {tk_chooseColor command } -body {
5454 tk_chooseColor -initialcolor
5555 } -returnCodes error -result {value for "-initialcolor" missing}
56 test clrpick-1.2 {tk_chooseColor command } -body {
56 test clrpick-1.2.1 {tk_chooseColor command } -body {
5757 tk_chooseColor -parent
5858 } -returnCodes error -result {value for "-parent" missing}
59 test clrpick-1.2 {tk_chooseColor command } -body {
59 test clrpick-1.2.2 {tk_chooseColor command } -body {
6060 tk_chooseColor -title
6161 } -returnCodes error -result {value for "-title" missing}
6262
241241 namespace import -force tcltest::interpreter
242242 namespace import -force tcltest::testsDirectory
243243 namespace import -force tcltest::cleanupTests
244 namespace import -force tcltest::bytestring
245244
246245 deleteWindows
247246 wm geometry . {}
33 # Copyright (c) 1998-1999 by Scriptics Corporation.
44 # All rights reserved.
55 #
6 # RCS: @(#) $Id: embed.test,v 1.5 2008/08/12 22:52:23 aniap Exp $
6 # RCS: @(#) $Id: embed.test,v 1.6 2008/12/19 15:33:40 dgp Exp $
77
88 package require tcltest 2.2
99 namespace import ::tcltest::*
3737 } -returnCodes error -result {A window cannot have both the -use and the -container option set.}
3838
3939 # testing window embedding for win platforms
40 test embed-1.4 {TkpUseWindow procedure, -container must be set} -constraints {
40 test embed-1.4.win {TkpUseWindow procedure, -container must be set} -constraints {
4141 win
4242 } -setup {
4343 deleteWindows
4848 deleteWindows
4949 } -returnCodes error -result {the window to use is not a Tk container}
5050 # testing window embedding for win platforms
51 test embed-1.5 {TkpUseWindow procedure, -container must be set} -constraints {
51 test embed-1.5.win {TkpUseWindow procedure, -container must be set} -constraints {
5252 win
5353 } -setup {
5454 deleteWindows
6060 } -returnCodes error -result {the window to use is not a Tk container}
6161
6262 # testing window embedding for other than win platforms
63 test embed-1.5 {TkpUseWindow procedure, -container must be set} -constraints {
63 test embed-1.4.nonwin {TkpUseWindow procedure, -container must be set} -constraints {
6464 nonwin
6565 } -setup {
6666 deleteWindows
7171 deleteWindows
7272 } -returnCodes error -result {window ".container" doesn't have -container option set}
7373 # testing window embedding for other than win platforms
74 test embed-1.6 {TkpUseWindow procedure, -container must be set} -constraints {
74 test embed-1.5.nonwin {TkpUseWindow procedure, -container must be set} -constraints {
7575 nonwin
7676 } -setup {
7777 deleteWindows
0 # Test the "tk::fontchooser" command
1 #
2 # Copyright (c) 2008 Pat Thoyts
3 #
4 # RCS: @(#) $Id: fontchooser.test,v 1.2 2008/12/10 13:41:19 patthoyts Exp $
5 #
6
7 package require tcltest 2.1
8 eval tcltest::configure $argv
9 tcltest::loadTestedCommands
10
11 # the following helper functions are related to the functions used
12 # in winDialog.test where they are used to send messages to the win32
13 # dialog (hence the wierdness).
14
15 proc start {cmd} {
16 set ::tk_dialog {}
17 set ::iter_after 0
18 after 1 $cmd
19 }
20 proc then {cmd} {
21 set ::command $cmd
22 set ::dialogresult {}
23 set ::testfont {}
24 afterbody
25 vwait ::dialogresult
26 return $::dialogresult
27 }
28 proc afterbody {} {
29 if {$::tk_dialog == {}} {
30 if {[incr ::iter_after] > 30} {
31 set ::dialogresult ">30 iterations waiting for tk_dialog"
32 return
33 }
34 after 150 {afterbody}
35 return
36 }
37 uplevel #0 {set dialogresult [eval $command]}
38 }
39 proc Click {button} {
40 switch -exact -- $button {
41 ok { $::tk_dialog.ok invoke }
42 cancel { $::tk_dialog.cancel invoke }
43 apply { $::tk_dialog.apply invoke }
44 default { return -code error "invalid button name \"$button\"" }
45 }
46 }
47 proc ApplyFont {font} {
48 # puts stderr "apply: $font"
49 set ::testfont $font
50 }
51
52 # -------------------------------------------------------------------------
53
54 test fontchooser-1.1 {tk fontchooser: usage} -returnCodes error -body {
55 tk fontchooser -z
56 } -result {unknown or ambiguous subcommand "-z": must be configure, hide, or show}
57
58 test fontchooser-1.2 {tk fontchooser: usage} -returnCodes error -body {
59 tk fontchooser configure -z
60 } -match glob -result {bad option "-z":*}
61
62 test fontchooser-1.3 {tk fontchooser: usage} -returnCodes error -body {
63 tk fontchooser configure -parent . -font
64 } -result {value for "-font" missing}
65
66 test fontchooser-1.4 {tk fontchooser: usage} -returnCodes error -body {
67 tk fontchooser configure -parent . -title
68 } -result {value for "-title" missing}
69
70 test fontchooser-1.5 {tk fontchooser: usage} -returnCodes error -body {
71 tk fontchooser configure -parent . -command
72 } -result {value for "-command" missing}
73
74 test fontchooser-1.6 {tk fontchooser: usage} -returnCodes error -body {
75 tk fontchooser configure -title . -parent
76 } -result {value for "-parent" missing}
77
78 test fontchooser-1.7 {tk fontchooser: usage} -returnCodes error -body {
79 tk fontchooser configure -parent abc
80 } -result {bad window path name "abc"}
81
82 test fontchooser-1.8 {tk fontchooser: usage} -returnCodes ok -body {
83 tk fontchooser configure -visible
84 } -result {0}
85
86 test fontchooser-1.9 {tk fontchooser: usage} -returnCodes error -body {
87 tk fontchooser configure -visible 1
88 } -match glob -result {*}
89
90 # -------------------------------------------------------------------------
91 #
92 # The remaining tests in this file are only relevant for the script
93 # implementation. They can be tested by sourcing the script file but
94 # the Tk tests are run with -singleproc 1 and doing this affects the
95 # result of later attempts to test the native implementations.
96 #
97 testConstraint scriptImpl [llength [info proc ::tk::fontchooser::Configure]]
98
99 test fontchooser-2.0 {fontchooser -title} -constraints scriptImpl -body {
100 start {
101 tk::fontchooser::Configure -title "Hello"
102 tk::fontchooser::Show
103 }
104 then {
105 set x [wm title $::tk_dialog]
106 Click cancel
107 }
108 set x
109 } -result {Hello}
110
111 test fontchooser-2.1 {fontchooser -title (cyrillic)} -constraints scriptImpl -body {
112 start {
113 tk::fontchooser::Configure \
114 -title "\u041f\u0440\u0438\u0432\u0435\u0442"
115 tk::fontchooser::Show
116 }
117 then {
118 set x [wm title $::tk_dialog]
119 Click cancel
120 }
121 set x
122 } -result "\u041f\u0440\u0438\u0432\u0435\u0442"
123
124 test fontchooser-3.0 {fontchooser -parent} -constraints scriptImpl -body {
125 start {
126 tk::fontchooser::Configure -parent .
127 tk::fontchooser::Show
128 }
129 then {
130 set x [winfo parent $::tk_dialog]
131 Click cancel
132 }
133 set x
134 } -result {.}
135
136 test fontchooser-3.1 {fontchooser -parent (invalid)} -constraints scriptImpl -body {
137 tk::fontchooser::Configure -parent junk
138 } -returnCodes error -match glob -result {bad window path *}
139
140 test fontchooser-4.0 {fontchooser -font} -constraints scriptImpl -body {
141 start {
142 tk::fontchooser::Configure -command ApplyFont -font courier
143 tk::fontchooser::Show
144 }
145 then {
146 Click cancel
147 }
148 set ::testfont
149 } -result {}
150
151 test fontchooser-4.1 {fontchooser -font} -constraints scriptImpl -body {
152 start {
153 tk::fontchooser::Configure -command ApplyFont -font courier
154 tk::fontchooser::Show
155 }
156 then {
157 Click ok
158 }
159 expr {$::testfont ne {}}
160 } -result {1}
161
162 test fontchooser-4.2 {fontchooser -font} -constraints scriptImpl -body {
163 start {
164 tk::fontchooser::Configure -command ApplyFont -font TkDefaultFont
165 tk::fontchooser::Show
166 }
167 then {
168 Click ok
169 }
170 expr {$::testfont ne {}}
171 } -result {1}
172
173 test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body {
174 start {
175 tk::fontchooser::Configure -command ApplyFont -font {times 14 bold}
176 tk::fontchooser::Show
177 }
178 then {
179 Click ok
180 }
181 expr {$::testfont ne {}}
182 } -result {1}
183
184 test fontchooser-4.4 {fontchooser -font} -constraints scriptImpl -body {
185 start {
186 tk::fontchooser::Configure -command ApplyFont -font {times 14 bold}
187 tk::fontchooser::Show
188 }
189 then {
190 Click ok
191 }
192 lrange $::testfont 1 end
193 } -result {14 bold}
194
195 # -------------------------------------------------------------------------
196
197 cleanupTests
198 return
199
200 # Local Variables:
201 # mode: tcl
202 # indent-tabs-mode: nil
203 # End:
66 # Copyright (c) 1998-1999 by Scriptics Corporation.
77 # All rights reserved.
88 #
9 # RCS: @(#) $Id: scrollbar.test,v 1.23 2008/10/08 18:57:47 dgp Exp $
9 # RCS: @(#) $Id: scrollbar.test,v 1.24 2008/12/12 00:09:38 nijtmans Exp $
1010
1111 package require tcltest 2.1
1212 eval tcltest::configure $argv
5858 {-activebackground #ff0000 #ff0000 non-existent
5959 {unknown color name "non-existent"}}
6060 {-activerelief sunken sunken non-existent
61 {bad relief type "non-existent": must be flat, groove, raised, ridge, solid, or sunken}}
61 {bad relief "non-existent": must be flat, groove, raised, ridge, solid, or sunken}}
6262 {-background #ff0000 #ff0000 non-existent
6363 {unknown color name "non-existent"}}
6464 {-bd 4 4 badValue {bad screen distance "badValue"}}
7676 {-orient horizontal horizontal badValue
7777 {bad orientation "badValue": must be vertical or horizontal}}
7878 {-orient horizontal horizontal bogus {bad orientation "bogus": must be vertical or horizontal}}
79 {-relief ridge ridge badValue {bad relief type "badValue": must be flat, groove, raised, ridge, solid, or sunken}}
79 {-relief ridge ridge badValue {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}}
8080 {-repeatdelay 140 140 129.3 {expected integer but got "129.3"}}
8181 {-repeatinterval 140 140 129.3 {expected integer but got "129.3"}}
8282 {-takefocus "any string" "any string" {} {}}
55 # Copyright (c) 1998-1999 by Scriptics Corporation.
66 # All rights reserved.
77 #
8 # RCS: @(#) $Id: text.test,v 1.51 2008/08/03 15:30:26 aniap Exp $
8 # RCS: @(#) $Id: text.test,v 1.54 2008/12/19 15:33:40 dgp Exp $
99
1010 package require tcltest 2.2
1111 eval tcltest::configure $argv
1919 wm minsize . 1 1
2020 wm positionfrom . user
2121 wm deiconify .
22
23
22
2423 test text-1.1 {configuration option: "autoseparators"} -setup {
2524 text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
2625 pack .t
781780 } -cleanup {
782781 destroy .t
783782 } -match glob -returnCodes {error} -result {*}
784
785783 test text-1.81 {text options} -setup {
786784 text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
787785 pack .t
812810 } -cleanup {
813811 destroy .t
814812 } -result {-yscrollcommand yScrollCommand ScrollCommand {} {test command}}
813 test text-1.83.1 {configuration option: "insertunfocussed"} -setup {
814 text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
815 pack .t
816 update
817 } -body {
818 .t configure -insertunfocussed none
819 .t cget -insertunfocussed
820 } -cleanup {
821 destroy .t
822 } -result none
823 test text-1.84 {configuration option: "insertunfocussed"} -setup {
824 text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
825 pack .t
826 update
827 } -body {
828 .t configure -insertunfocussed hollow
829 .t cget -insertunfocussed
830 } -cleanup {
831 destroy .t
832 } -result hollow
833 test text-1.85 {configuration option: "insertunfocussed"} -setup {
834 text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
835 pack .t
836 update
837 } -body {
838 .t configure -insertunfocussed solid
839 .t cget -insertunfocussed
840 } -cleanup {
841 destroy .t
842 } -result solid
843 test text-1.86 {configuration option: "insertunfocussed"} -setup {
844 text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
845 pack .t
846 update
847 } -returnCodes error -body {
848 .t configure -insertunfocussed gorp
849 } -cleanup {
850 destroy .t
851 } -result {bad insertunfocussed "gorp": must be hollow, none, or solid}
815852
816853
817854 test text-2.1 {Tk_TextCmd procedure} -body {
842879 } -cleanup {
843880 destroy .t
844881 } -result {2 red}
845
846882 test text-2.7 {Tk_TextCmd procedure} -constraints {
847883 win
848884 } -body {
870906 } -cleanup {
871907 destroy .t
872908 } -result {raised}
873
874909 test text-2.10 {Tk_TextCmd procedure} -body {
875910 list [text .t] [winfo class .t]
876911 } -cleanup {
12481283 } -cleanup {
12491284 destroy .t
12501285 } -result {abcdefghijklm}
1251
12521286 test text-8.10 {TextWidgetCmd procedure, "delete" option} -setup {
12531287 text .t
12541288 } -body {
13451379 destroy .t
13461380 } -result {foo
13471381 ghijklm}
1348
13491382 test text-8.18 {TextWidgetCmd procedure, "replace" option} -setup {
13501383 text .t
13511384 } -body {
13801413 } -cleanup {
13811414 destroy .t
13821415 } -returnCodes ok -result {}
1383
13841416 test text-8.21 {TextWidgetCmd procedure, "replace" option with undo} -setup {
13851417 text .t
13861418 } -body {
14521484 } -cleanup {
14531485 destroy .t
14541486 } -result {1}
1455
14561487 test text-8.24 {TextWidgetCmd procedure, "replace" option with peers, undo} -setup {
14571488 text .t
14581489 } -body {
15951626 !@#$%
15961627 Line 7
15971628 }
1598
15991629 test text-9.8 {TextWidgetCmd procedure, "get" option} -setup {
16001630 text .t
16011631 } -body {
17651795 } -cleanup {
17661796 destroy .t
17671797 } -result {5.5}
1768
17691798 test text-9.20 {TextWidgetCmd procedure, "get" option} -setup {
17701799 text .t
17711800 } -body {
18801909 } -cleanup {
18811910 destroy .t
18821911 } -result {5.1 5.1}
1883
18841912 test text-9.27 {TextWidgetCmd procedure, "get" option} -setup {
18851913 text .t
18861914 } -body {
20472075 } -cleanup {
20482076 destroy .t
20492077 } -result {29}
2050
20512078 test text-10.9 {TextWidgetCmd procedure, "count" option} -setup {
20522079 text .t
20532080 .t insert 1.0 "Line 1
21042131 } -cleanup {
21052132 destroy .t
21062133 } -returnCodes {error} -result {bad text index "foo"}
2107
21082134 test text-10.13 {TextWidgetCmd procedure, "count" option} -setup {
21092135 text .t
21102136 } -body {
21542180 } -cleanup {
21552181 destroy .t
21562182 } -result {5}
2157
21582183 test text-10.16 {TextWidgetCmd procedure, "count" option} -setup {
21592184 text .t
21602185 } -body {
24972522 } -cleanup {
24982523 destroy .t
24992524 } -result {19}
2500
25012525 test text-10.30 {TextWidgetCmd procedure, "count" option} -setup {
25022526 text .t
25032527 } -body {
29853009 (while processing -tabs option)
29863010 invoked from within
29873011 ".t configure -tabs {30 foo}"}
2988
29893012 test text-14.7 {ConfigureText procedure} -setup {
29903013 text .t
29913014 } -body {
31083131 } -cleanup {
31093132 destroy .t .t2
31103133 } -result {1234}
3111
31123134 test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
31133135 toplevel .top
31143136 text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
31213143 } -cleanup {
31223144 destroy .top
31233145 } -result {150x140+}
3146 # This test was failing Windows because the title bar on .t was a certain
3147 # minimum size and it was interfering with the size requested by the -setgrid.
3148 # The "overrideredirect" gets rid of the titlebar so the toplevel can shrink
3149 # to the appropriate size.
31243150 test text-14.19 {ConfigureText procedure} -setup {
3125 # This test was failing Windows because the title bar on .t
3126 # was a certain minimum size and it was interfering with the size
3127 # requested by the -setgrid. The "overrideredirect" gets rid of the
3128 # titlebar so the toplevel can shrink to the appropriate size.
31293151 toplevel .top
31303152 text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
31313153 } -body {
31383160 } -cleanup {
31393161 destroy .top
31403162 } -result {20x10+0+0}
3141
3163 # This test was failing on Windows because the title bar on .t was a certain
3164 # minimum size and it was interfering with the size requested by the -setgrid.
3165 # The "overrideredirect" gets rid of the titlebar so the toplevel can shrink
3166 # to the appropriate size.
31423167 test text-14.20 {ConfigureText procedure} -setup {
3143 # This test was failing on Windows because the title bar on .t
3144 # was a certain minimum size and it was interfering with the size
3145 # requested by the -setgrid. The "overrideredirect" gets rid of the
3146 # titlebar so the toplevel can shrink to the appropriate size.
31473168 toplevel .top
31483169 text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
31493170 } -body {
32103231 update
32113232 set geom [wm geometry .top]
32123233 set x [string range $geom 0 [string first + $geom]]
3213
32143234 rename .top.t {}
32153235 update
32163236 set geom [wm geometry .top]
34623482 } -cleanup {
34633483 destroy .top
34643484 } -result {2.0 y}
3465
34663485 test text-19.13 {DeleteChars procedure, updates affecting topIndex} -setup {
34673486 toplevel .top
34683487 text .top.t -width 1 -height 10 -wrap char
35933612 destroy .t
35943613 } -result {0a..1b.2b.3b.4
35953614 cj.0j.1j.2j.3j.4m}
3596
35973615 test text-20.5 {TextFetchSelection procedure, long selections} -setup {
35983616 text .t -width 20 -height 10
35993617 pack append . .t {top expand fill}
36413659 } -cleanup {
36423660 destroy .t .t2
36433661 } -result {1.2 3.3}
3644
36453662 test text-21.3 {TkTextLostSelection procedure} -body {
36463663 text .t
36473664 .t insert 1.0 "abcdef\nghijk\n1234"
39523969 } -cleanup {
39533970 destroy .t
39543971 } -result {4.0}
3955
39563972 test text-22.41 {TextSearchCmd procedure, firstChar and lastChar} -setup {
39573973 toplevel .top
39583974 text .top.t -width 30 -height 10 -font {Courier -12} -borderwidth 2 -highlightthickness 2
40314047 } -cleanup {
40324048 destroy .top
40334049 } -result {1.1}
4034
40354050 test text-22.47 {TextSearchCmd procedure, firstChar and lastChar} -body {
40364051 text .t
40374052 .t insert end "xxyz xyz x. the\nfoo -forward bar xxxxx BaR foo\nxyz xxyzx"
56785693 } -cleanup {
56795694 destroy .t
56805695 } -result {}
5681
56825696 test text-24.11 {TextDumpCmd procedure, stop at begin-line} -body {
56835697 pack [text .t]
56845698 .t insert end "Line One\nLine Two\nLine Three\nLine Four"
56965710 } -result {text {One
56975711 } 1.5 text {Line Two
56985712 } 2.0 text {Line Three} 3.0}
5699
57005713 test text-24.13 {TextDumpCmd procedure, tags only} -body {
57015714 pack [text .t]
57025715 .t insert end "Line One\nLine Two\nLine Three\nLine Four"
57155728 } -cleanup {
57165729 destroy .t
57175730 } -result {tagon x 2.0}
5718
57195731 test text-24.15 {TextDumpCmd procedure, tags only} -body {
57205732 pack [text .t]
57215733 .t insert end "Line One\nLine Two\nLine Three\nLine Four"
57345746 } -cleanup {
57355747 destroy .t
57365748 } -result {tagon y 1.0 tagon x 2.0 tagoff x 2.8 tagoff y 5.0}
5737
57385749 test text-24.17 {TextDumpCmd procedure, marks only} -body {
57395750 pack [text .t]
57405751 .t insert end "Line One\nLine Two\nLine Three\nLine Four"
57835794 } -cleanup {
57845795 destroy .t
57855796 } -result {mark current 1.0 mark insert 1.0 mark m 2.4 mark n 4.0 mark END 5.0}
5786
57875797 test text-24.21 {TextDumpCmd procedure, windows only} -setup {
57885798 pack [text .t]
57895799 .t insert end "Line One\nLine Two\nLine Three\nLine Four"
58085818 } -cleanup {
58095819 destroy .t
58105820 } -result {window {} 100.0}
5811
58125821 test text-24.23 {TextDumpCmd procedure, command script} -setup {
58135822 set x {}
58145823 pack [text .t]
58505859 destroy .t
58515860 rename Append {}
58525861 } -result {mark 1.0 current mark 1.0 insert mark 2.4 m}
5853
58545862 test text-24.25 {TextDumpCmd procedure, unicode characters} -body {
58555863 text .t
58565864 .t insert 1.0 \xb1\xb1\xb1
64416449
64426450 test text-32.1 {line heights on creation} -setup {
64436451 text .t
6444
64456452 proc makeText {} {
64466453 set w .g
64476454 set font "Times 11"
64496456 toplevel .g
64506457 frame $w.f -highlightthickness 2 -borderwidth 2 -relief sunken
64516458 set t $w.f.text
6452 text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font -width 70 \
6453 -height 35 -wrap word -highlightthickness 0 -borderwidth 0
6459 text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font \
6460 -width 70 -height 35 -wrap word -highlightthickness 0 \
6461 -borderwidth 0
64546462 pack $t -expand yes -fill both
64556463 scrollbar $w.scroll -command "$t yview"
64566464 pack $w.scroll -side right -fill y
66526660 } -result {ok}
66536661
66546662
6663 test text-36.1 "bug #1777362: event handling with hyphenated windows" -setup {
6664 proc bgerror {m} {set ::my_error $m}
6665 set ::my_error {}
6666 pack [set w [text .t-1]]
6667 } -body {
6668 tkwait visibility $w
6669 event generate $w <1>
6670 event generate $w <1>
6671 update
6672 set ::my_error
6673 } -cleanup {
6674 destroy .t-1
6675 } -result {}
6676 test text-36.2 "bug #1777362: event handling with hyphenated windows" -setup {
6677 proc bgerror {m} {set ::my_error $m}
6678 set ::my_error {}
6679 pack [set w [text .t+1]]
6680 } -body {
6681 tkwait visibility $w
6682 event generate $w <1>
6683 event generate $w <1>
6684 update
6685 set ::my_error
6686 } -cleanup {
6687 destroy $w
6688 } -result {}
6689 test text-36.3 "bug #1777362: event handling with hyphenated windows" -setup {
6690 proc bgerror {m} {set ::my_error $m}
6691 set ::my_error {}
6692 pack [set w [text .t*1]]
6693 } -body {
6694 tkwait visibility $w
6695 event generate $w <1>
6696 event generate $w <1>
6697 update
6698 set ::my_error
6699 } -cleanup {
6700 destroy $w
6701 } -result {}
6702
66556703 # cleanup
66566704 cleanupTests
66576705 return
66586706
6659
6660
6661
6662
6707 # Local Variables:
6708 # mode: tcl
6709 # End:
55 # Copyright (c) 1998-1999 by Scriptics Corporation.
66 # All rights reserved.
77 #
8 # RCS: @(#) $Id: textMark.test,v 1.11 2008/08/28 08:52:06 aniap Exp $
8 # RCS: @(#) $Id: textMark.test,v 1.13 2008/12/19 15:33:40 dgp Exp $
99
1010 package require tcltest 2.2
1111 namespace import ::tcltest::*
12 eval tcltest::configure $argv
12 tcltest::configure {*}$argv
1313 tcltest::loadTestedCommands
14
1514
1615 destroy .t
1716 text .t -width 20 -height 10
2928 !@#$%
3029 Line 7"
3130
32 testConstraint haveCourier12 [expr {[catch {
33 .t configure -font {Courier 12}
34 }] == 0}]
35
36 # The statements below reset the main window; it's needed if the window
31 # The statements below reset the main window; it's needed if the window
3732 # manager is mwm to make mwm forget about a previous minimum size setting.
3833
3934 wm withdraw .
4035 wm minsize . 1 1
4136 wm positionfrom . user
4237 wm deiconify .
43
44
45 test textMark-1.1 {TkTextMarkCmd - missing option} -constraints {
46 haveCourier12
47 } -body {
38
39 test textMark-1.1 {TkTextMarkCmd - missing option} -returnCodes error -body {
4840 .t mark
49 } -returnCodes error -result {wrong # args: should be ".t mark option ?arg ...?"}
50 test textMark-1.2 {TkTextMarkCmd - bogus option} -constraints {
51 haveCourier12
52 } -body {
41 } -result {wrong # args: should be ".t mark option ?arg ...?"}
42 test textMark-1.2 {TkTextMarkCmd - bogus option} -returnCodes error -body {
5343 .t mark gorp
54 } -returnCodes error -result {bad mark option "gorp": must be gravity, names, next, previous, set, or unset}
55 test textMark-1.3 {TkTextMarkCmd - "gravity" option} -constraints {
56 haveCourier12
57 } -body {
44 } -match glob -result {bad mark option "gorp": must be *}
45 test textMark-1.3 {TkTextMarkCmd - "gravity" option} -returnCodes error -body {
5846 .t mark gravity foo
59 } -returnCodes error -result {there is no mark named "foo"}
60 test textMark-1.4 {TkTextMarkCmd - "gravity" option} -constraints {
61 haveCourier12
62 } -body {
47 } -result {there is no mark named "foo"}
48 test textMark-1.4 {TkTextMarkCmd - "gravity" option} -body {
6349 .t mark set x 1.3
6450 .t insert 1.3 x
6551 list [.t mark gravity x] [.t index x]
6652 } -result {right 1.4}
67 test textMark-1.5 {TkTextMarkCmd - "gravity" option} -constraints {
68 haveCourier12
69 } -body {
53 test textMark-1.5 {TkTextMarkCmd - "gravity" option} -body {
7054 .t mark set x 1.3
7155 .t mark g x left
7256 .t insert 1.3 x
7357 list [.t mark gravity x] [.t index x]
7458 } -result {left 1.3}
75 test textMark-1.6 {TkTextMarkCmd - "gravity" option} -constraints {
76 haveCourier12
77 } -body {
59 test textMark-1.6 {TkTextMarkCmd - "gravity" option} -body {
7860 .t mark set x 1.3
7961 .t mark gravity x right
8062 .t insert 1.3 x
8163 list [.t mark gravity x] [.t index x]
8264 } -result {right 1.4}
83 test textMark-1.7 {TkTextMarkCmd - "gravity" option} -constraints {
84 haveCourier12
85 } -body {
65 test textMark-1.7 {TkTextMarkCmd - "gravity" option} -returnCodes error -body {
8666 .t mark set x 1.3
8767 .t mark gravity x gorp
88 } -returnCodes error -result {bad mark gravity "gorp": must be left or right}
89 test textMark-1.8 {TkTextMarkCmd - "gravity" option} -constraints {
90 haveCourier12
91 } -body {
68 } -result {bad mark gravity "gorp": must be left or right}
69 test textMark-1.8 {TkTextMarkCmd - "gravity" option} -returnCodes error -body {
9270 .t mark gravity
93 } -returnCodes error -result {wrong # args: should be ".t mark gravity markName ?gravity?"}
94
95
96 test textMark-2.1 {TkTextMarkCmd - "names" option} -constraints {
97 haveCourier12
98 } -body {
71 } -result {wrong # args: should be ".t mark gravity markName ?gravity?"}
72
73 test textMark-2.1 {TkTextMarkCmd - "names" option} -body {
9974 .t mark names 2
10075 } -returnCodes error -result {wrong # args: should be ".t mark names"}
101 test textMark-2.2 {TkTextMarkCmd - "names" option} -constraints {
102 haveCourier12
103 } -setup {
76 test textMark-2.2 {TkTextMarkCmd - "names" option} -setup {
10477 .t mark unset {*}[.t mark names]
10578 } -body {
10679 lsort [.t mark na]
10780 } -result {current insert}
108 test textMark-2.3 {TkTextMarkCmd - "names" option} -constraints {
109 haveCourier12
110 } -setup {
81 test textMark-2.3 {TkTextMarkCmd - "names" option} -setup {
11182 .t mark unset {*}[.t mark names]
11283 } -body {
11384 .t mark set a 1.1
11586 lsort [.t mark names]
11687 } -result {a {b c} current insert}
11788
118
119 test textMark-3.1 {TkTextMarkCmd - "set" option} -constraints {
120 haveCourier12
121 } -body {
89 test textMark-3.1 {TkTextMarkCmd - "set" option} -returnCodes error -body {
12290 .t mark set a
123 } -returnCodes error -result {wrong # args: should be ".t mark set markName index"}
124 test textMark-3.2 {TkTextMarkCmd - "set" option} -constraints {
125 haveCourier12
126 } -body {
91 } -result {wrong # args: should be ".t mark set markName index"}
92 test textMark-3.2 {TkTextMarkCmd - "set" option} -returnCodes error -body {
12793 .t mark s a b c
128 } -returnCodes error -result {wrong # args: should be ".t mark set markName index"}
129 test textMark-3.3 {TkTextMarkCmd - "set" option} -constraints {
130 haveCourier12
131 } -body {
94 } -result {wrong # args: should be ".t mark set markName index"}
95 test textMark-3.3 {TkTextMarkCmd - "set" option} -body {
13296 .t mark set a @x
13397 } -returnCodes error -result {bad text index "@x"}
134 test textMark-3.4 {TkTextMarkCmd - "set" option} -constraints {
135 haveCourier12
136 } -body {
98 test textMark-3.4 {TkTextMarkCmd - "set" option} -body {
13799 .t mark set a 1.2
138100 .t index a
139101 } -result 1.2
140 test textMark-3.5 {TkTextMarkCmd - "set" option} -constraints {
141 haveCourier12
142 } -body {
102 test textMark-3.5 {TkTextMarkCmd - "set" option} -body {
143103 .t mark set a end
144104 .t index a
145105 } -result {8.0}
146106
147
148 test textMark-4.1 {TkTextMarkCmd - "unset" option} -constraints {
149 haveCourier12
150 } -body {
107 test textMark-4.1 {TkTextMarkCmd - "unset" option} -body {
151108 .t mark unset
152 } -returnCodes ok -result {}
153 test textMark-4.2 {TkTextMarkCmd - "unset" option} -constraints {
154 haveCourier12
155 } -body {
109 } -result {}
110 test textMark-4.2 {TkTextMarkCmd - "unset" option} -body {
156111 .t mark set a 1.2
157112 .t mark set b 2.3
158113 .t mark unset a b
159114 .t index a
160115 } -returnCodes error -result {bad text index "a"}
161 test textMark-4.2 {TkTextMarkCmd - "unset" option} -constraints {
162 haveCourier12
163 } -body {
116 test textMark-4.2.1 {TkTextMarkCmd - "unset" option} -body {
164117 .t mark set a 1.2
165118 .t mark set b 2.3
166119 .t mark unset a b
167120 .t index b
168121 } -returnCodes error -result {bad text index "b"}
169 test textMark-4.3 {TkTextMarkCmd - "unset" option} -constraints {
170 haveCourier12
171 } -body {
122 test textMark-4.3 {TkTextMarkCmd - "unset" option} -body {
172123 .t mark set a 1.2
173124 .t mark set b 2.3
174125 .t mark set 49ers 3.1
175 eval .t mark unset [.t mark names]
126 .t mark unset {*}[.t mark names]
176127 lsort [.t mark names]
177128 } -result {current insert}
178129
179
180 test textMark-5.1 {TkTextMarkCmd - miscellaneous} -constraints {
181 haveCourier12
182 } -body {
130 test textMark-5.1 {TkTextMarkCmd - miscellaneous} -returnCodes error -body {
183131 .t mark
184 } -returnCodes error -result {wrong # args: should be ".t mark option ?arg ...?"}
185 test textMark-5.2 {TkTextMarkCmd - miscellaneous} -constraints {
186 haveCourier12
187 } -body {
132 } -result {wrong # args: should be ".t mark option ?arg ...?"}
133 test textMark-5.2 {TkTextMarkCmd - miscellaneous} -returnCodes error -body {
188134 .t mark foo
189 } -returnCodes error -result {bad mark option "foo": must be gravity, names, next, previous, set, or unset}
190
191
192 test textMark-6.1 {TkTextMarkSegToIndex} -constraints haveCourier12 -body {
135 } -result {bad mark option "foo": must be gravity, names, next, previous, set, or unset}
136
137 test textMark-6.1 {TkTextMarkSegToIndex} -body {
193138 .t mark set a 1.2
194139 .t mark set b 1.2
195140 .t mark set c 1.2
197142 list [.t index a] [.t index b] [.t index c ] [.t index d]
198143 } -result {1.2 1.2 1.2 1.4}
199144
200
201 test textMark-7.1 {MarkFindNext - invalid mark name} -constraints {
202 haveCourier12
203 } -body {
145 test textMark-7.1 {MarkFindNext - invalid mark name} -body {
204146 .t mark next bogus
205147 } -returnCodes error -result {bad text index "bogus"}
206 test textMark-7.2 {MarkFindNext - marks at same location} -constraints {
207 haveCourier12
208 } -body {
148 test textMark-7.2 {MarkFindNext - marks at same location} -body {
209149 .t mark set insert 2.0
210150 .t mark set current 2.0
211151 .t mark next current
212152 } -result {insert}
213 test textMark-7.3 {MarkFindNext - numerical starting mark} -constraints {
214 haveCourier12
215 } -body {
153 test textMark-7.3 {MarkFindNext - numerical starting mark} -body {
216154 .t mark set current 1.0
217155 .t mark set insert 1.0
218156 .t mark next 1.0
219157 } -result {insert}
220 test textMark-7.4 {MarkFindNext - mark on the same line} -constraints {
221 haveCourier12
222 } -setup {
158 test textMark-7.4 {MarkFindNext - mark on the same line} -setup {
223159 .t mark unset {*}[.t mark names]
224160 } -body {
225161 .t mark set current 1.0
226162 .t mark set insert 1.1
227163 .t mark next current
228164 } -result {insert}
229 test textMark-7.5 {MarkFindNext - mark on the next line} -constraints {
230 haveCourier12
231 } -setup {
165 test textMark-7.5 {MarkFindNext - mark on the next line} -setup {
232166 .t mark unset {*}[.t mark names]
233167 } -body {
234168 .t mark set current 1.end
235169 .t mark set insert 2.0
236170 .t mark next current
237171 } -result {insert}
238 test textMark-7.6 {MarkFindNext - mark far away} -constraints {
239 haveCourier12
240 } -setup {
172 test textMark-7.6 {MarkFindNext - mark far away} -setup {
241173 .t mark unset {*}[.t mark names]
242174 } -body {
243175 .t mark set current 1.2
244176 .t mark set insert 7.0
245177 .t mark next current
246178 } -result {insert}
247 test textMark-7.7 {MarkFindNext - mark on top of end} -constraints {
248 haveCourier12
249 } -setup {
179 test textMark-7.7 {MarkFindNext - mark on top of end} -setup {
250180 .t mark unset {*}[.t mark names]
251181 } -body {
252182 .t mark set current end
253183 .t mark next end
254184 } -result {current}
255 test textMark-7.8 {MarkFindNext - no next mark} -constraints {
256 haveCourier12
257 } -setup {
185 test textMark-7.8 {MarkFindNext - no next mark} -setup {
258186 .t mark unset {*}[.t mark names]
259187 } -body {
260188 .t mark set current 1.0
262190 .t mark next insert
263191 } -result {}
264192
265
266 test textMark-8.1 {MarkFindPrev - invalid mark name} -constraints {
267 haveCourier12
268 } -body {
193 test textMark-8.1 {MarkFindPrev - invalid mark name} -body {
269194 .t mark prev bogus
270195 } -returnCodes error -result {bad text index "bogus"}
271 test textMark-8.2 {MarkFindPrev - marks at same location} -constraints {
272 haveCourier12
273 } -body {
196 test textMark-8.2 {MarkFindPrev - marks at same location} -body {
274197 .t mark set insert 2.0
275198 .t mark set current 2.0
276199 .t mark prev insert
277200 } -result {current}
278 test textMark-8.3 {MarkFindPrev - numerical starting mark} -constraints {
279 haveCourier12
280 } -setup {
201 test textMark-8.3 {MarkFindPrev - numerical starting mark} -setup {
281202 .t mark unset {*}[.t mark names]
282203 } -body {
283204 .t mark set current 1.0
284205 .t mark set insert 1.0
285206 .t mark prev 1.1
286207 } -result {current}
287 test textMark-8.4 {MarkFindPrev - mark on the same line} -constraints {
288 haveCourier12
289 } -setup {
208 test textMark-8.4 {MarkFindPrev - mark on the same line} -setup {
290209 .t mark unset {*}[.t mark names]
291210 } -body {
292211 .t mark set current 1.0
293212 .t mark set insert 1.1
294213 .t mark prev insert
295214 } -result {current}
296 test textMark-8.5 {MarkFindPrev - mark on the previous line} -constraints {
297 haveCourier12
298 } -setup {
215 test textMark-8.5 {MarkFindPrev - mark on the previous line} -setup {
299216 .t mark unset {*}[.t mark names]
300217 } -body {
301218 .t mark set current 1.end
302219 .t mark set insert 2.0
303220 .t mark prev insert
304221 } -result {current}
305 test textMark-8.6 {MarkFindPrev - mark far away} -constraints {
306 haveCourier12
307 } -setup {
222 test textMark-8.6 {MarkFindPrev - mark far away} -setup {
308223 .t mark unset {*}[.t mark names]
309224 } -body {
310225 .t mark set current 1.2
311226 .t mark set insert 7.0
312227 .t mark prev insert
313228 } -result {current}
314 test textMark-8.7 {MarkFindPrev - mark on top of end} -constraints {
315 haveCourier12
316 } -setup {
229 test textMark-8.7 {MarkFindPrev - mark on top of end} -setup {
317230 .t mark unset {*}[.t mark names]
318231 } -body {
319232 .t mark set insert 3.0
320233 .t mark set current end
321234 .t mark prev end
322235 } -result {insert}
323 test textMark-8.8 {MarkFindPrev - no previous mark} -constraints {
324 haveCourier12
325 } -setup {
236 test textMark-8.8 {MarkFindPrev - no previous mark} -setup {
326237 .t mark unset {*}[.t mark names]
327238 } -body {
328239 .t mark set current 1.0
329240 .t mark set insert 3.0
330241 .t mark prev current
331242 } -result {}
332
243
333244 destroy .t
334245
335246 # cleanup
336247 cleanupTests
337248 return
338249
250 # Local Variables:
251 # mode: tcl
252 # End:
55 # Copyright (c) 1998-1999 by Scriptics Corporation.
66 # All rights reserved.
77 #
8 # RCS: @(#) $Id: textTag.test,v 1.14 2008/08/28 08:52:06 aniap Exp $
8 # RCS: @(#) $Id: textTag.test,v 1.15 2008/12/12 00:09:38 nijtmans Exp $
99
1010 package require tcltest 2.2
1111 namespace import ::tcltest::*
214214 .t tag configure x -relief stupid
215215 } -cleanup {
216216 .t tag configure x -relief [lindex [.t tag configure x -relief] 3]
217 } -returnCodes error -result {bad relief type "stupid": must be flat, groove, raised, ridge, solid, or sunken}
217 } -returnCodes error -result {bad relief "stupid": must be flat, groove, raised, ridge, solid, or sunken}
218218 test textTag-1.24 {tag configuration options} -constraints {
219219 haveCourier12
220220 } -body {
44 # Copyright (c) 1998-1999 by Scriptics Corporation.
55 # Copyright (c) 2002 ActiveState Corporation.
66 #
7 # RCS: @(#) $Id: tk.test,v 1.15 2008/08/16 23:52:34 aniap Exp $
7 # RCS: @(#) $Id: tk.test,v 1.17 2008/12/10 10:54:56 patthoyts Exp $
88
99 package require tcltest 2.2
1010 eval tcltest::configure $argv
1313
1414 test tk-1.1 {tk command: general} -body {
1515 tk
16 } -returnCodes error -result {wrong # args: should be "tk option ?arg?"}
16 } -returnCodes error -result {wrong # args: should be "tk subcommand ?arg ...?"}
1717 test tk-1.2 {tk command: general} -body {
1818 tk xyz
19 } -returnCodes error -result {bad option "xyz": must be appname, caret, scaling, useinputmethods, windowingsystem, or inactive}
20
19 } -returnCodes error -result {unknown or ambiguous subcommand "xyz": must be appname, busy, caret, fontchooser, inactive, scaling, useinputmethods, or windowingsystem}
2120
2221 # Value stored to restore default settings after 2.* tests
2322 set appname [tk appname]
3534 tk appname [tk appname]
3635 } -result [tk appname]
3736 tk appname $appname
38
3937
4038 # Value stored to restore default settings after 3.* tests
4139 set scaling [tk scaling]
7169 test tk-3.9 {tk command: scaling: too big} -body {
7270 tk scaling 1000000
7371 expr {[tk scaling] < 10000}
74 } -result {1}
72 } -result {1}
7573 test tk-3.10 {tk command: scaling: widthmm} -body {
7674 tk scaling 1.25
7775 expr {int((25.4*[winfo screenwidth .])/(72*1.25) + 0.5) \
8381 - [winfo screenmmheight .]}
8482 } -result {0}
8583 tk scaling $scaling
86
8784
8885 # Value stored to restore default settings after 4.* tests
8986 set useim [tk useinputmethods]
108105 tk useinputmethods -displayof . xyz
109106 } -returnCodes error -result {expected boolean value but got "xyz"}
110107 test tk-4.6 {tk command: useinputmethods: set new} -body {
111 # This isn't really a test, but more of a check...
112 # The answer is what was given, because we may be on a Unix
113 # system that doesn't have the XIM stuff
108 # This isn't really a test, but more of a check... The answer is what was
109 # given, because we may be on a Unix system that doesn't have the XIM
110 # stuff
114111 if {[tk useinputmethods 1] == 0} {
115 puts "this wish doesn't have XIM (X Input Methods) support"
112 puts "this wish doesn't have XIM (X Input Methods) support"
116113 }
117
118114 return $useim
119115 } -result $useim
120116 test tk-4.7 {tk command: useinputmethods: set new} -constraints win -body {
121 # Mac and Windows don't have X Input Methods, so this should
122 # always return 0
117 # Mac and Windows don't have X Input Methods, so this should always return
118 # 0
123119 tk useinputmethods 1
124120 } -cleanup {
125121 tk useinputmethods $useim
126122 } -result 0
127
128123
129124 test tk-5.1 {tk caret} -body {
130125 tk caret
144139 test tk-5.6 {tk caret} -body {
145140 tk caret . -x 20 -y 25 -h 30; tk caret . -hei
146141 } -result {30}
147
148142
149143 # tk inactive
150144 test tk-6.1 {tk inactive} -body {
167161 expr {$i == -1 || ( $i > 90 && $i < 200 )}
168162 } -result 1
169163
170
171164 test tk-7.1 {tk inactive in a safe interpreter} -body {
172165 # tk inactive in safe interpreters
173166 safe::interpCreate foo
185178 ::safe::interpDelete foo
186179 } -returnCodes 1 -result {resetting the user inactivity timer is not allowed in a safe interpreter}
187180
181 # tests of [tk busy] in busy.test
188182
189183 # cleanup
190184 cleanupTests
5555 lappend result Start 0 [.cb get]
5656 ttk::combobox::Post .cb
5757 lappend result Post [winfo ismapped .cb.popdown] [.cb get]
58 .cb.popdown.l selection clear 0 end; .cb.popdown.l selection set 1
59 ttk::combobox::LBSelected .cb.popdown.l
58 .cb.popdown.f.l selection clear 0 end; .cb.popdown.f.l selection set 1
59 ttk::combobox::LBSelected .cb.popdown.f.l
6060 lappend result Select [winfo ismapped .cb.popdown] [.cb get]
6161 update
6262 set result
0 #
1 # ttk::spinbox widget tests
2 #
3
4 package require Tk
5 package require tcltest ; namespace import -force tcltest::*
6 loadTestedCommands
7
8 test spinbox-1.0 "Spinbox tests -- setup" -body {
9 ttk::spinbox .sb
10 } -cleanup { destroy .sb } -result .sb
11
12 test spinbox-1.1 "Bad -values list" -setup {
13 ttk::spinbox .sb
14 } -body {
15 .sb configure -values "bad \{list"
16 } -cleanup {
17 destroy .sb
18 } -returnCodes error -result "unmatched open brace in list"
19
20 test spinbox-1.3.1 "get retrieves value" -setup {
21 ttk::spinbox .sb -from 0 -to 100
22 } -body {
23 .sb set 50
24 .sb get
25 } -cleanup {
26 destroy .sb
27 } -result 50
28
29 test spinbox-1.3.2 "get retrieves value" -setup {
30 ttk::spinbox .sb -from 0 -to 100 -values 55
31 } -body {
32 .sb set 55
33 .sb get
34 } -cleanup {
35 destroy .sb
36 } -result 55
37
38 test spinbox-1.4.1 "set changes value" -setup {
39 ttk::spinbox .sb -from 0 -to 100
40 } -body {
41 .sb set 33
42 .sb get
43 } -cleanup {
44 destroy .sb
45 } -result 33
46
47 test spinbox-1.4.2 "set changes value" -setup {
48 ttk::spinbox .sb -from 0 -to 100 -values 55
49 } -body {
50 .sb set 33
51 .sb get
52 } -cleanup {
53 destroy .sb
54 } -result 33
55
56
57 test spinbox-1.6.1 "insert start" -setup {
58 ttk::spinbox .sb -from 0 -to 100
59 } -body {
60 .sb set 5
61 .sb insert 0 4
62 .sb get
63 } -cleanup {
64 destroy .sb
65 } -result 45
66
67 test spinbox-1.6.2 "insert end" -setup {
68 ttk::spinbox .sb -from 0 -to 100
69 } -body {
70 .sb set 5
71 .sb insert end 4
72 .sb get
73 } -cleanup {
74 destroy .sb
75 } -result 54
76
77 test spinbox-1.6.3 "insert invalid index" -setup {
78 ttk::spinbox .sb -from 0 -to 100
79 } -body {
80 .sb set 5
81 .sb insert 100 4
82 .sb get
83 } -cleanup {
84 destroy .sb
85 } -result 54
86
87 test spinbox-1.7.1 "-command option: set doesnt fire" -setup {
88 ttk::spinbox .sb -from 0 -to 100 -command {set ::spinbox_test 1}
89 } -body {
90 set ::spinbox_test 0
91 .sb set 50
92 set ::spinbox_test
93 } -cleanup {
94 destroy .sb
95 } -result 0
96
97 test spinbox-1.7.2 "-command option: button handler will fire" -setup {
98 ttk::spinbox .sb -from 0 -to 100 -command {set ::spinbox_test 1}
99 } -body {
100 set ::spinbox_test 0
101 .sb set 50
102 event generate .sb <<Increment>>
103 set ::spinbox_test
104 } -cleanup {
105 destroy .sb
106 } -result 1
107
108 test spinbox-1.8.1 "option -validate" -setup {
109 ttk::spinbox .sb -from 0 -to 100
110 } -body {
111 .sb configure -validate all
112 .sb cget -validate
113 } -cleanup {
114 destroy .sb
115 } -result {all}
116
117 test spinbox-1.8.2 "option -validate" -setup {
118 ttk::spinbox .sb -from 0 -to 100
119 } -body {
120 .sb configure -validate key
121 .sb configure -validate focus
122 .sb configure -validate focusin
123 .sb configure -validate focusout
124 .sb configure -validate none
125 .sb cget -validate
126 } -cleanup {
127 destroy .sb
128 } -result {none}
129
130 test spinbox-1.8.3 "option -validate" -setup {
131 ttk::spinbox .sb -from 0 -to 100
132 } -body {
133 .sb configure -validate bogus
134 } -cleanup {
135 destroy .sb
136 } -returnCodes error -result {bad validate "bogus": must be all, key, focus, focusin, focusout, or none}
137
138 test spinbox-1.8.4 "-validate option: " -setup {
139 set ::spinbox_test {}
140 ttk::spinbox .sb -from 0 -to 100
141 } -body {
142 .sb configure -validate all -validatecommand {lappend ::spinbox_test %P}
143 pack .sb
144 .sb set 50
145 focus .sb
146 after 100 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
147 set ::spinbox_test
148 } -cleanup {
149 destroy .sb
150 } -result {50}
151
152
153 test spinbox-2.0 "current command -- unset should be 0" -constraints nyi -setup {
154 ttk::spinbox .sb -values [list a b c d e a]
155 } -body {
156 .sb current
157 } -cleanup {
158 destroy .sb
159 } -result 0
160 # @@@ for combobox, this is -1.
161
162 test spinbox-2.1 "current command -- set index" -constraints nyi -setup {
163 ttk::spinbox .sb -values [list a b c d e a]
164 } -body {
165 .sb current 5
166 .sb get
167 } -cleanup {
168 destroy .sb
169 } -result a
170
171 test spinbox-2.2 "current command -- change -values" -constraints nyi -setup {
172 ttk::spinbox .sb -values [list a b c d e a]
173 } -body {
174 .sb current 5
175 .sb configure -values [list c b a d e]
176 .sb current
177 } -cleanup {
178 destroy .sb
179 } -result 2
180
181 test spinbox-2.3 "current command -- change value" -constraints nyi -setup {
182 ttk::spinbox .sb -values [list c b a d e]
183 } -body {
184 .sb current 2
185 .sb set "b"
186 .sb current
187 } -cleanup {
188 destroy .sb
189 } -result 1
190
191 test spinbox-2.4 "current command -- value not in list" -constraints nyi -setup {
192 ttk::spinbox .sb -values [list c b a d e]
193 } -body {
194 .sb current 2
195 .sb set "z"
196 .sb current
197 } -cleanup {
198 destroy .sb
199 } -result -1
200
201 # nostomp: NB intentional difference between ttk::spinbox and tk::spinbox;
202 # see also #1439266
203 #
204 test spinbox-nostomp-1 "don't stomp on -variable (init; -from/to)" -body {
205 set SBV 55
206 ttk::spinbox .sb -textvariable SBV -from 0 -to 100 -increment 5
207 list $SBV [.sb get]
208 } -cleanup {
209 unset SBV
210 destroy .sb
211 } -result [list 55 55]
212
213 test spinbox-nostomp-2 "don't stomp on -variable (init; -values)" -body {
214 set SBV Apr
215 ttk::spinbox .sb -textvariable SBV -values {Jan Feb Mar Apr May Jun Jul Aug}
216 list $SBV [.sb get]
217 } -cleanup {
218 unset SBV
219 destroy .sb
220 } -result [list Apr Apr]
221
222 test spinbox-nostomp-3 "don't stomp on -variable (configure; -from/to)" -body {
223 set SBV 55
224 ttk::spinbox .sb
225 .sb configure -textvariable SBV -from 0 -to 100 -increment 5
226 list $SBV [.sb get]
227 } -cleanup {
228 unset SBV
229 destroy .sb
230 } -result [list 55 55]
231
232 test spinbox-nostomp-4 "don't stomp on -variable (configure; -values)" -body {
233 set SBV Apr
234 ttk::spinbox .sb
235 .sb configure -textvariable SBV -values {Jan Feb Mar Apr May Jun Jul Aug}
236 list $SBV [.sb get]
237 } -cleanup {
238 unset SBV
239 destroy .sb
240 } -result [list Apr Apr]
241
242 test spinbox-dieoctaldie-1 "Cope with leading zeros" -body {
243 # See SF#2358545 -- ttk::spinbox also affected
244 set secs 07
245 ttk::spinbox .sb -from 0 -to 59 -format %02.0f -textvariable secs
246
247 set result [list $secs]
248 event generate .sb <<Increment>>; lappend result $secs
249 event generate .sb <<Increment>>; lappend result $secs
250 event generate .sb <<Increment>>; lappend result $secs
251 event generate .sb <<Increment>>; lappend result $secs
252
253 event generate .sb <<Decrement>>; lappend result $secs
254 event generate .sb <<Decrement>>; lappend result $secs
255 event generate .sb <<Decrement>>; lappend result $secs
256 event generate .sb <<Decrement>>; lappend result $secs
257
258 set result
259 } -result [list 07 08 09 10 11 10 09 08 07] -cleanup {
260 destroy .sb
261 unset secs
262 }
263
264 test spinbox-dieoctaldie-2 "Cope with general bad input" -body {
265 set result [list]
266 ttk::spinbox .sb -from 0 -to 100 -format %03.0f
267 .sb set asdfasdf ; lappend result [.sb get]
268 event generate .sb <<Increment>> ; lappend result [.sb get]
269 .sb set asdfasdf ; lappend result [.sb get]
270 event generate .sb <<Decrement>> ; lappend result [.sb get]
271 } -result [list asdfasdf 000 asdfasdf 000] -cleanup {
272 destroy .sb
273 }
274
275 tcltest::cleanupTests
276
277 # Local variables:
278 # mode: tcl
279 # End:
2727 winfo exists .sd
2828 } -result 0
2929
30 test ttk-6.3 "Test package cleanup" -body {
31 interp create foo
32 foo eval { if {[catch {package require Tk}]} { load {} Tk } }
33 foo eval { destroy . }
34 interp delete foo
35 }
36
37 test ttk-6.4 "Defeat evil intentions" -body {
30 # test ttk-6.3 not applicable [see #2175411]
31
32 test ttk-6.4 "Destroy widget in configure" -setup {
33 set OUCH ouch
3834 trace variable OUCH r { kill.b }
3935 proc kill.b {args} { destroy .b }
36 } -cleanup {
37 unset OUCH
38 } -body {
4039 pack [ttk::checkbutton .b]
41 .b configure -variable OUCH
42 # At this point, .b should be gone.
43 .b invoke
44 list [set OUCH] [winfo exists .b]
45 # Mostly we just care that we haven't crashed the interpreter.
46 #
47 } -returnCodes error -match glob -result "*"
40 set rc [catch { .b configure -variable OUCH } msg]
41 list $rc $msg [winfo exists .b] [info commands .b]
42 } -result [list 1 "Widget has been destroyed" 0 {}]
4843
4944 test ttk-6.5 "Clean up -textvariable traces" -body {
5045 foreach class {ttk::button ttk::checkbutton ttk::radiobutton} {
6560 set ::bgerror
6661 } -result {unknown color name "badColor"}
6762
68 # This should move to be a standard test per widget test file
6963 test ttk-6.7 "Basic destruction test" -body {
7064 foreach widget {
7165 button checkbutton radiobutton sizegrip separator notebook
8478 set ::A
8579 } -result {it worked}
8680
87 #
88 #
89
9081 test ttk-6.9 "Bad font spec in styles" -setup {
9182 ttk::style theme create badfont -settings {
9283 ttk::style configure . -font {Helvetica 12 Bogus}
10293 set ::bgerror
10394 } -result {unknown font style "Bogus"}
10495
96 test ttk-construction-failure-1 "Excercise construction failure path" -setup {
97 option add *TLabel.cursor badCursor 1
98 } -cleanup {
99 option add *TLabel.cursor {} 1
100 } -body {
101 catch {ttk::label .l} errmsg
102 list $errmsg [info commands .l] [winfo exists .l]
103 } -result [list {bad cursor spec "badCursor"} {} 0]
104
105 test ttk-construction-failure-2 "Destroy widget in constructor" -setup {
106 set OUCH ouch
107 trace variable OUCH r { kill.b }
108 proc kill.b {args} { destroy .b }
109 } -cleanup {
110 unset OUCH
111 } -body {
112 list \
113 [catch { ttk::checkbutton .b -variable OUCH } msg] \
114 $msg \
115 [winfo exists .b] \
116 [info commands .b] \
117 ;
118 } -result [list 1 "Widget has been destroyed" 0 {}]
119
120 test ttk-selfdestruct-ok-1 "Intentional self-destruction" -body {
121 # see #2298720
122 toplevel .t
123 ttk::button .t.b -command [list destroy .t]
124 .t.b invoke
125 list [winfo exists .t] [winfo exists .t.b]
126 } -result [list 0 0]
127
105128 #
106129 # Basic tests.
107130 #
114137 test ttk-1.2 "Check style" -body {
115138 .t cget -style
116139 } -result {}
117
118140
119141 test ttk-1.4 "Restore default style" -body {
120142 .t cget -style
171193 set x
172194 } -result 1
173195
174
175196 # misc. error detection
176197 test ttk-3.0 "Bad option" -body {
177198 ttk::button .bad -badoption foo
189210 } -cleanup {
190211 unset ::A ; destroy .cb
191212 } -returnCodes error -result {can't set "A": failure}
213
214 test ttk-3.3 "Constructor failure with cursor" -body {
215 ttk::button .b -cursor bottom_right_corner -style BadStyle
216 } -returnCodes 1 -result "Layout BadStyle not found"
192217
193218 test ttk-3.4 "SF#2009213" -body {
194219 ttk::style configure TScale -sliderrelief {}
443468
444469 test ttk-9.7 "Unset textvariable, comparison" -body {
445470 #
446 # NB: the ttk label behaves differently from the standard label here;
471 # NB: ttk::label behaves differently from the standard label here;
447472 # NB: this is on purpose: I believe the standard behaviour is the Wrong Thing
448473 #
449474 unset -nocomplain V1 V2
553578 update
554579 }
555580
556
557581 test ttk-13.1 "Custom styles -- bad -style option" -body {
558582 ttk::button .tb1 -style badstyle
559583 } -returnCodes 1 -result "*badstyle not found*" -match glob
593617 ttk::entry .tw -textvariable ::nsn::foo
594618 } -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
595619 -match glob -cleanup { destroy .tw }
596
597620
598621 test ttk-15.1 "style element create: insufficient args" -body {
599622 ttk::style element create
88 # See the file "license.terms" for information on usage and redistribution
99 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 #
11 # RCS: @(#) $Id: unixSelect.test,v 1.11 2008/08/30 21:52:26 aniap Exp $
11 # RCS: @(#) $Id: unixSelect.test,v 1.12 2008/10/30 21:50:08 dgp Exp $
1212
1313 package require tcltest 2.2
1414 namespace import ::tcltest::*
116116 } -body {
117117 pack [entry .e]
118118 update
119 .e insert 0 [encoding convertfrom identity \u00fcber]
119 .e insert 0 \u00fcber
120120 .e selection range 0 end
121 dobg {string bytelength [selection get]}
121 dobg {string length [selection get]}
122122 } -cleanup {
123123 cleanupbg
124124 destroy .e
125 } -result {5}
125 } -result {4}
126126
127127 test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} -constraints {
128128 unix
135135 .e insert 0 \u00fc\u0444
136136 .e selection range 0 end
137137 }
138 set x [selection get]
139 list [string equal \u00fc? $x] \
140 [string length $x] [string bytelength $x]
141 } -cleanup {
142 cleanupbg
143 } -result {1 2 3}
138 selection get
139 } -cleanup {
140 cleanupbg
141 } -result \u00fc?
144142
145143 test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -constraints {
146144 unix
155153 set selInfo {}
156154 set result [dobg {
157155 set x [selection get -type COMPOUND_TEXT]
158 list [string equal \u00fc\u0444 $x] \
159 [string length $x] [string bytelength $x]
156 list [string equal \u00fc\u0444 $x] [string length $x]
160157 }]
161158 lappend result $selInfo
162159 } -cleanup {
163160 cleanupbg
164 } -result {1 2 4 {COMPOUND_TEXT 0 4000}}
161 } -result {1 2 {COMPOUND_TEXT 0 4000}}
165162
166163 test unixSelect-1.4 {TkSelGetSelection procedure: INCR i18n text, iso2022} -constraints {
167164 unix
182179 set x [selection get -type COMPOUND_TEXT]
183180 list [string equal \
184181 [string repeat x 3999]\u00fc\u0444[string repeat x 3999] $x] \
185 [string length $x] [string bytelength $x]
182 [string length $x]
186183 }]
187184 lappend result $selInfo
188185 } -cleanup {
189186 cleanupbg
190 } -result {1 8000 8002 {COMPOUND_TEXT 0 4000 COMPOUND_TEXT 4000 3999 COMPOUND_TEXT 7998 4000 COMPOUND_TEXT 0 4000 COMPOUND_TEXT 4000 3998 COMPOUND_TEXT 7997 4000}}
187 } -result {1 8000 {COMPOUND_TEXT 0 4000 COMPOUND_TEXT 4000 3999 COMPOUND_TEXT 7998 4000 COMPOUND_TEXT 0 4000 COMPOUND_TEXT 4000 3998 COMPOUND_TEXT 7997 4000}}
191188
192189 test unixSelect-1.5 {TkSelGetSelection procedure: simple i18n text, iso2022} -constraints {
193190 unix
202199 set selInfo {}
203200 set result [dobg {
204201 set x [selection get -type COMPOUND_TEXT]
205 list [string equal \u00fc\u0444 $x] \
206 [string length $x] [string bytelength $x]
202 list [string equal \u00fc\u0444 $x] [string length $x]
207203 }]
208204 lappend result $selInfo
209205 } -cleanup {
210206 cleanupbg
211 } -result {1 2 4 {COMPOUND_TEXT 0 4000}}
207 } -result {1 2 {COMPOUND_TEXT 0 4000}}
212208
213209 test unixSelect-1.6 {TkSelGetSelection procedure: INCR i18n text} -constraints {
214210 unix
215211 } -setup {
216212 setupbg
217213 } -body {
218 dobg "entry .e; pack .e; update
219 .e insert 0 \[encoding convertfrom identity \\u00fcber\]$longValue
220 .e selection range 0 end"
221 string bytelength [selection get]
222 } -cleanup {
223 cleanupbg
224 } -result [expr {5 + [string bytelength $longValue]}]
214 dobg [subst -nobackslashes {entry .e; pack .e; update
215 .e insert 0 \u00fcber$longValue
216 .e selection range 0 end}]
217 string length [selection get]
218 } -cleanup {
219 cleanupbg
220 } -result [expr {4 + [string length $longValue]}]
225221
226222 test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} -constraints {
227223 unix
234230 .e insert 0 [string repeat x 3999]\u00fc
235231 .e selection range 0 end
236232 }
237 set x [selection get]
238 list [string equal [string repeat x 3999]\u00fc $x] \
239 [string length $x] [string bytelength $x]
240 } -cleanup {
241 cleanupbg
242 } -result {1 4000 4001}
233 selection get
234 } -cleanup {
235 cleanupbg
236 } -result [string repeat x 3999]\u00fc
243237
244238 test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints {
245239 unix
252246 .e insert 0 \u00fc[string repeat x 3999]
253247 .e selection range 0 end
254248 }
255 set x [selection get]
256 list [string equal \u00fc[string repeat x 3999] $x] \
257 [string length $x] [string bytelength $x]
258 } -cleanup {
259 cleanupbg
260 } -result {1 4000 4001}
249 selection get
250 } -cleanup {
251 cleanupbg
252 } -result \u00fc[string repeat x 3999]
261253
262254 test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints {
263255 unix
270262 .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000]
271263 .e selection range 0 end
272264 }
273 set x [selection get]
274 list [string equal [string repeat x 3999]\u00fc[string repeat x 4000] $x] \
275 [string length $x] [string bytelength $x]
276 } -cleanup {
277 cleanupbg
278 } -result {1 8000 8001}
265 selection get
266 } -cleanup {
267 cleanupbg
268 } -result [string repeat x 3999]\u00fc[string repeat x 4000]
279269 # Now some tests to make sure that the right thing is done when
280270 # transferring UTF8 selections, to prevent [Bug 614650] and its ilk
281271 # from rearing its ugly head again.
291281 .e insert 0 [string repeat x 3999]\u00fc
292282 .e selection range 0 end
293283 }
294 set x [selection get -type UTF8_STRING]
295 list [string equal [string repeat x 3999]\u00fc $x] \
296 [string length $x] [string bytelength $x]
297 } -cleanup {
298 cleanupbg
299 } -result {1 4000 4001}
284 selection get -type UTF8_STRING
285 } -cleanup {
286 cleanupbg
287 } -result [string repeat x 3999]\u00fc
300288
301289 test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
302290 unix
309297 .e insert 0 \u00fc[string repeat x 3999]
310298 .e selection range 0 end
311299 }
312 set x [selection get -type UTF8_STRING]
313 list [string equal \u00fc[string repeat x 3999] $x] \
314 [string length $x] [string bytelength $x]
315 } -cleanup {
316 cleanupbg
317 } -result {1 4000 4001}
300 selection get -type UTF8_STRING
301 } -cleanup {
302 cleanupbg
303 } -result \u00fc[string repeat x 3999]
318304
319305 test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
320306 unix
327313 .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000]
328314 .e selection range 0 end
329315 }
330 set x [selection get -type UTF8_STRING]
331 list [string equal [string repeat x 3999]\u00fc[string repeat x 4000] $x] \
332 [string length $x] [string bytelength $x]
333 } -cleanup {
334 cleanupbg
335 } -result {1 8000 8001}
316 selection get -type UTF8_STRING
317 } -cleanup {
318 cleanupbg
319 } -result [string repeat x 3999]\u00fc[string repeat x 4000]
336320
337321 test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints {
338322 unix
342326 } -body {
343327 pack [entry .e]
344328 update
345 .e insert 0 [encoding convertfrom identity \u00fcber\u0444]
329 .e insert 0 \u00fcber\u0444
346330 .e selection range 0 end
347 dobg {string bytelength [selection get -type UTF8_STRING]}
331 dobg {string length [selection get -type UTF8_STRING]}
348332 } -cleanup {
349333 destroy .e
350334 cleanupbg
361345 .e insert 0 \u00fc\u0444
362346 .e selection range 0 end
363347 }
364 set x [selection get -type UTF8_STRING]
365 list [string equal \u00fc\u0444 $x] \
366 [string length $x] [string bytelength $x]
367 } -cleanup {
368 cleanupbg
369 } -result {1 2 4}
348 selection get -type UTF8_STRING
349 } -cleanup {
350 cleanupbg
351 } -result \u00fc\u0444
370352
371353 test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
372354 unix
379361 .e insert 0 [string repeat [string repeat \u00c4\u00e4 50]\n 21]
380362 .e selection range 0 end
381363 }
382 set x [selection get -type UTF8_STRING]
383 list [string equal [string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
384 [string length $x] [string bytelength $x]
385 } -cleanup {
386 cleanupbg
387 } -result {1 2121 4221}
364 selection get -type UTF8_STRING
365 } -cleanup {
366 cleanupbg
367 } -result [string repeat [string repeat \u00c4\u00e4 50]\n 21]
388368
389369 test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
390370 unix
397377 .e insert 0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
398378 .e selection range 0 end
399379 }
400 set x [selection get -type UTF8_STRING]
401 list [string equal i[string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
402 [string length $x] [string bytelength $x]
403 } -cleanup {
404 cleanupbg
405 } -result {1 2122 4222}
380 selection get -type UTF8_STRING
381 } -cleanup {
382 cleanupbg
383 } -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
406384
407385 test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
408386 unix
417395 .t tag add sel 1.0 21.end+1c
418396 }
419397 after 10
420 set x [selection get -type UTF8_STRING]
421 list [string equal [string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
422 [string length $x] [string bytelength $x]
423 } -cleanup {
424 cleanupbg
425 } -result {1 2121 4221}
398 selection get -type UTF8_STRING
399 } -cleanup {
400 cleanupbg
401 } -result [string repeat [string repeat \u00c4\u00e4 50]\n 21]
426402
427403 test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
428404 unix
437413 .t tag add sel 1.0 21.end+1c
438414 }
439415 after 10
440 set x [selection get -type UTF8_STRING]
441 list [string equal i[string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
442 [string length $x] [string bytelength $x]
443 } -cleanup {
444 cleanupbg
445 } -result {1 2122 4222}
416 selection get -type UTF8_STRING
417 } -cleanup {
418 cleanupbg
419 } -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
446420
447421 test unixSelect-1.19 {Automatic UTF8_STRING support for selection handle} -constraints {
448422 unix
99 # Copyright (c) 1998-2000 by Scriptics Corporation.
1010 # All rights reserved.
1111 #
12 # RCS: @(#) $Id: winClipboard.test,v 1.15 2008/08/18 16:09:10 aniap Exp $
12 # RCS: @(#) $Id: winClipboard.test,v 1.17 2008/11/03 22:02:12 patthoyts Exp $
1313
1414 package require tcltest 2.2
1515 eval tcltest::configure $argv
5555 } -setup {
5656 clipboard clear
5757 } -body {
58 set map [list "\r" "\\r" "\n" "\\n"]
5859 clipboard append "line 1\nline 2"
59 list [selection get -selection CLIPBOARD] [testclipboard]
60 list [string map $map [selection get -selection CLIPBOARD]]\
61 [string map $map [testclipboard]]
6062 } -cleanup {
6163 clipboard clear
62 } -result [list "line 1\nline 2" "line 1\r\nline 2"]
64 } -result [list "line 1\\nline 2" "line 1\\nline 2"]
6365
6466 test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} -constraints {
6567 win testclipboard
6668 } -setup {
6769 clipboard clear
6870 } -body {
71 set map [list "\r" "\\r" "\n" "\\n"]
6972 clipboard append "line 1\u00c7\nline 2"
73 list [string map $map [selection get -selection CLIPBOARD]]\
74 [string map $map [testclipboard]]
75 } -cleanup {
76 clipboard clear
77 } -result [list "line 1\u00c7\\nline 2" "line 1\u00c7\\nline 2"]
78
79 test winClipboard-1.6 {TkSelGetSelection & TkWinClipboardRender} -constraints {
80 win testclipboard
81 } -setup {
82 clipboard clear
83 } -body {
84 clipboard append "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"
7085 list [selection get -selection CLIPBOARD] [testclipboard]
7186 } -cleanup {
7287 clipboard clear
73 } -result [list "line 1\u00c7\nline 2" [bytestring "line 1\u00c7\r\nline 2"]]
74
88 } -result [list "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"\
89 "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"]
7590
7691 test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} -constraints {
7792 win testclipboard
103118 cleanupTests
104119 return
105120
121 # Local variables:
122 # mode: tcl
123 # End:
66 # Copyright (c) 1998-1999 by Scriptics Corporation.
77 # Copyright (c) 1998-1999 ActiveState Corporation.
88 #
9 # RCS: @(#) $Id: winDialog.test,v 1.21 2008/10/07 18:33:47 dgp Exp $
9 # RCS: @(#) $Id: winDialog.test,v 1.25 2008/12/10 13:41:19 patthoyts Exp $
1010
1111 package require tcltest 2.2
1212 namespace import ::tcltest::*
1717 catch {testwinevent debug 1}
1818 }
1919
20 # Locale identifier LANG_ENGLISH is 0x09
21 testConstraint english [expr {
22 [llength [info commands testwinlocale]]
23 && (([testwinlocale] & 0xff) == 9)
24 }]
25
2026 proc start {arg} {
2127 set ::tk_dialog 0
2228 set ::iter_after 0
2733 proc then {cmd} {
2834 set ::command $cmd
2935 set ::dialogresult {}
36 set ::testfont {}
3037
3138 afterbody
3239 vwait ::dialogresult
3542
3643 proc afterbody {} {
3744 if {$::tk_dialog == 0} {
38 if {[incr ::iter_after] > 30} {
39 set ::dialogresult ">30 iterations waiting on tk_dialog"
45 if {[incr ::iter_after] > 30} {
46 set ::dialogresult ">30 iterations waiting on tk_dialog"
47 return
48 }
49 after 150 {afterbody}
4050 return
4151 }
42 after 150 {afterbody}
43 return
44 }
4552 uplevel #0 {set dialogresult [eval $command]}
4653 }
4754
4855 proc Click {button} {
56 switch -exact -- $button {
57 ok { set button 1 }
58 cancel { set button 2 }
59 }
4960 testwinevent $::tk_dialog $button WM_LBUTTONDOWN 1 0x000a000b
5061 testwinevent $::tk_dialog $button WM_LBUTTONUP 0 0x000a000b
5162 }
5263
53 proc GetText {button} {
54 return [testwinevent $::tk_dialog $button WM_GETTEXT]
55 }
56
57 proc SetText {button text} {
58 return [testwinevent $::tk_dialog $button WM_SETTEXT $text]
64 proc GetText {id} {
65 switch -exact -- $id {
66 ok { set id 1 }
67 cancel { set id 2 }
68 }
69 return [testwinevent $::tk_dialog $id WM_GETTEXT]
70 }
71
72 proc SetText {id text} {
73 return [testwinevent $::tk_dialog $id WM_SETTEXT $text]
74 }
75
76 proc ApplyFont {font} {
77 set ::testfont $font
5978 }
6079
6180 # ----------------------------------------------------------------------
82101 } -body {
83102 start {set clr [tk_chooseColor -initialcolor "#ff9933"]}
84103 then {
85 set x [Click 1]
104 set x [Click ok]
86105 }
87106 list $x $clr
88107 } -result [list 0 "#ff9933"]
98117 array set a [testgetwindowinfo $::tk_dialog]
99118 if {[info exists a(text)]} {lappend x $a(text)}
100119 } err]} { lappend x $err }
101 lappend x [Click 1]
120 lappend x [Click ok]
102121 }
103122 lappend x $clr
104123 } -result [list Hello 0 "#ff9933"]
117136 array set a [testgetwindowinfo $::tk_dialog]
118137 if {[info exists a(text)]} {lappend x $a(text)}
119138 } err]} { lappend x $err }
120 lappend x [Click 1]
139 lappend x [Click ok]
121140 }
122141 lappend x $clr
123142 } -result [list "\u041f\u0440\u0438\u0432\u0435\u0442" 0 "#ff9933"]
135154 append x [expr {$a(parent) == [wm frame .]}]
136155 }
137156 } err]} {lappend x $err}
138 Click 1
157 Click ok
139158 }
140159 list $x $clr
141160 } -result [list 1 "#ff9933"]
150169
151170
152171 test winDialog-3.1 {Tk_GetOpenFileObjCmd} -constraints {
153 nt testwinevent
172 nt testwinevent english
154173 } -body {
155174 start {tk_getOpenFile}
156175 then {
157 set x [GetText 2]
158 Click 2
176 set x [GetText cancel]
177 Click cancel
159178 }
160179 return $x
161180 } -result {Cancel}
162181
163182
164183 test winDialog-4.1 {Tk_GetSaveFileObjCmd} -constraints {
165 nt testwinevent
184 nt testwinevent english
166185 } -body {
167186 start {tk_getSaveFile}
168187 then {
169 set x [GetText 2]
170 Click 2
188 set x [GetText cancel]
189 Click cancel
171190 }
172191 return $x
173192 } -result {Cancel}
221240 start {set x [tk_getSaveFile -defaultextension .foo -title Save]}
222241 then {
223242 SetText 0x480 bar
224 Click 1
243 Click ok
225244 }
226245 string totitle $x
227246 } -result [string totitle [file join [pwd] bar.foo]]
231250 start {set x [tk_getSaveFile -defaultextension foo -title Save]}
232251 then {
233252 SetText 0x480 bar
234 Click 1
253 Click ok
235254 }
236255 string totitle $x
237256 } -result [string totitle [file join [pwd] bar.foo]]
264283 -initialdir [file normalize $::env(TEMP)] \
265284 -initialfile "12x 455" -title Foo]}
266285 then {
267 Click 1
286 Click ok
268287 }
269288 return $x
270289 } -result [file join [file normalize $::env(TEMP)] "12x 455"]
283302
284303 start {set x [tk_getSaveFile -initialfile "12x 456" -title Foo]}
285304 then {
286 Click 1
305 Click ok
287306 }
288307 string totitle $x
289308 } -result [string totitle [file join [pwd] "12x 456"]]
302321 } x]
303322 }
304323 then {
305 Click 1
324 Click ok
306325 }
307326 list $dialogresult [string match "invalid filename *" $x]
308327 } -result {1 1}
326345
327346 start {tk_getOpenFile -title Narf}
328347 then {
329 Click 2
348 Click cancel
330349 }
331350 } -result {0}
332351 test winDialog-5.18 {GetFileName: no filter specified} -constraints {
337356 start {tk_getOpenFile -title Filter}
338357 then {
339358 set x [GetText 0x470]
340 Click 2
359 Click cancel
341360 }
342361 return $x
343362 } -result {All Files (*.*)}
367386 }
368387 } -result {}
369388 test winDialog-5.21 {GetFileName: call GetOpenFileName} -constraints {
370 nt testwinevent
389 nt testwinevent english
371390 } -body {
372391 # winCode = GetOpenFileName(&ofn);
373392
374393 start {tk_getOpenFile -title Open}
375394 then {
376 set x [GetText 1]
377 Click 2
395 set x [GetText ok]
396 Click cancel
378397 }
379398 return $x
380399 } -result {&Open}
381400 test winDialog-5.22 {GetFileName: call GetSaveFileName} -constraints {
382 nt testwinevent
401 nt testwinevent english
383402 } -body {
384403 # winCode = GetSaveFileName(&ofn);
385404
386405 start {tk_getSaveFile -title Save}
387406 then {
388 set x [GetText 1]
389 Click 2
407 set x [GetText ok]
408 Click cancel
390409 }
391410 return $x
392411 } -result {&Save}
396415 } -body {
397416 start {set x [tk_getSaveFile -title Back]}
398417 then {
399 SetText 0x480 "$::env(TEMP)\\12x 457"
400 Click 1
418 SetText 0x480 [file nativename \
419 [file join [file normalize $::env(TEMP)] "12x 457"]]
420 Click ok
401421 }
402422 return $x
403423 } -result [file join [file normalize $::env(TEMP)] "12x 457"]
409429
410430 start {set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {\0\0\0\0}}}}]}
411431 then {
412 Click 2
432 Click cancel
413433 }
414434 return $x
415435 } -result {0}
420440
421441 start {set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {\u2022\u2022\u2022\u2022}}}}]}
422442 then {
423 Click 2
443 Click cancel
424444 }
425445 return $x
426446 } -result {0}
487507
488508 start {set x [tk_chooseDirectory -initialdir c:/ -title Foo]}
489509 then {
490 Click 1
510 Click ok
491511 }
492512 string tolower [set x]
493513 } -result {c:/}
500520 tk_chooseDirectory -initialdir ~12x/455
501521 } -returnCodes error -result {user "12x" doesn't exist}
502522
523
524 test winDialog-10.1 {Tk_FontchooserObjCmd: no arguments} -constraints {
525 nt testwinevent
526 } -body {
527 start {tk fontchooser show}
528 list [then {
529 Click cancel
530 }] $::testfont
531 } -result {0 {}}
532 test winDialog-10.2 {Tk_FontchooserObjCmd: -initialfont} -constraints {
533 nt testwinevent
534 } -body {
535 start {
536 tk fontchooser configure -command ApplyFont -font system
537 tk fontchooser show
538 }
539 list [then {
540 Click cancel
541 }] $::testfont
542 } -result {0 {}}
543 test winDialog-10.3 {Tk_FontchooserObjCmd: -initialfont} -constraints {
544 nt testwinevent
545 } -body {
546 start {
547 tk fontchooser configure -command ApplyFont -font system
548 tk fontchooser show
549 }
550 list [then {
551 Click 1
552 }] [expr {[llength $::testfont] ne {}}]
553 } -result {0 1}
554 test winDialog-10.4 {Tk_FontchooserObjCmd: -title} -constraints {
555 nt testwinevent
556 } -body {
557 start {
558 tk fontchooser configure -command ApplyFont -title "tk test"
559 tk fontchooser show
560 }
561 list [then {
562 Click cancel
563 }] $::testfont
564 } -result {0 {}}
565 test winDialog-10.5 {Tk_FontchooserObjCmd: -parent} -constraints {
566 nt testwinevent
567 } -setup {
568 array set a {parent {}}
569 } -body {
570 start {
571 tk fontchooser configure -command ApplyFont -parent .
572 tk fontchooser show
573 }
574 then {
575 array set a [testgetwindowinfo $::tk_dialog]
576 Click cancel
577 }
578 list [expr {$a(parent) == [wm frame .]}] $::testfont
579 } -result {1 {}}
580 test winDialog-10.6 {Tk_FontchooserObjCmd: -apply} -constraints {
581 nt testwinevent
582 } -body {
583 start {
584 tk fontchooser configure -command FooBarBaz
585 tk fontchooser show
586 }
587 then {
588 Click cancel
589 }
590 } -result 0
591 test winDialog-10.7 {Tk_FontchooserObjCmd: -apply} -constraints {
592 nt testwinevent
593 } -body {
594 start {
595 tk fontchooser configure -command ApplyFont -parent .
596 tk fontchooser show
597 }
598 list [then {
599 Click [expr {0x0402}] ;# value from XP
600 Click cancel
601 }] [expr {[llength $::testfont] > 0}]
602 } -result {0 1}
603 test winDialog-10.8 {Tk_FontchooserObjCmd: -title} -constraints {
604 nt testwinevent
605 } -setup {
606 array set a {text failed}
607 } -body {
608 start {
609 tk fontchooser configure -command ApplyFont -title "Hello"
610 tk fontchooser show
611 }
612 then {
613 array set a [testgetwindowinfo $::tk_dialog]
614 Click cancel
615 }
616 set a(text)
617 } -result "Hello"
618 test winDialog-10.9 {Tk_FontchooserObjCmd: -title} -constraints {
619 nt testwinevent
620 } -setup {
621 array set a {text failed}
622 } -body {
623 start {
624 tk fontchooser configure -command ApplyFont \
625 -title "\u041f\u0440\u0438\u0432\u0435\u0442"
626 tk fontchooser show
627 }
628 then {
629 array set a [testgetwindowinfo $::tk_dialog]
630 Click cancel
631 }
632 set a(text)
633 } -result "\u041f\u0440\u0438\u0432\u0435\u0442"
634
503635 if {[testConstraint testwinevent]} {
504636 catch {testwinevent debug 0}
505637 }
55 # Copyright (c) 1998-1999 by Scriptics Corporation.
66 # All rights reserved.
77 #
8 # RCS: @(#) $Id: winfo.test,v 1.16 2008/08/30 21:52:26 aniap Exp $
8 # RCS: @(#) $Id: winfo.test,v 1.17 2008/11/03 14:36:20 patthoyts Exp $
99
1010 package require tcltest 2.2
1111 namespace import ::tcltest::*
389389 pack .emb.b -expand yes -fill both
390390 update
391391
392 expr {[winfo rootx .emb] == [winfo rootx .con] \
393 && [winfo rooty .emb] == [winfo rooty .con]}
394 } -cleanup {
395 deleteWindows
396 } -result {1}
392 list rootx [expr {[winfo rootx .emb] == [winfo rootx .con]}] \
393 rooty [expr {[winfo rooty .emb] == [winfo rooty .con]}]
394 } -cleanup {
395 deleteWindows
396 } -result {rootx 1 rooty 1}
397
397398 test winfo-13.2 {destroying embedded toplevel} -setup {
398399 deleteWindows
399400 } -body {
406407
407408 destroy .emb
408409 update
409 expr {[winfo exists .emb.b] || [winfo exists .con]}
410 } -cleanup {
411 deleteWindows
412 } -result 0
410 list embedded [winfo exists .emb.b] container [winfo exists .con]
411 } -cleanup {
412 deleteWindows
413 } -result {embedded 0 container 1}
413414
414415 test winfo-13.3 {destroying container window} -setup {
415416 deleteWindows
423424
424425 destroy .con
425426 update
426 expr {[winfo exists .emb.b] || [winfo exists .emb]}
427 } -cleanup {
428 deleteWindows
429 } -result 0
427 list child [winfo exists .emb.b] parent [winfo exists .emb]
428 } -cleanup {
429 deleteWindows
430 } -result {child 0 parent 0}
430431
431432 test winfo-13.4 {[winfo containing] with embedded windows} -setup {
432433 deleteWindows
66 # Copyright (c) 1998-1999 by Scriptics Corporation.
77 # All rights reserved.
88 #
9 # RCS: @(#) $Id: wm.test,v 1.45 2008/10/08 15:39:13 dgp Exp $
9 # RCS: @(#) $Id: wm.test,v 1.46 2008/11/15 00:00:27 patthoyts Exp $
1010
1111 # This file tests window manager interactions that work across platforms.
1212 # Window manager tests that only work on a specific platform should be placed
20902090 }
20912091
20922092 ### Docking test (manage, forget) ###
2093 test wm-manage-1.1 {managing a button} -setup {
2093 test wm-manage-1.1 {managing a frame} -setup {
20942094 set result [list]
20952095 } -body {
20962096 toplevel .t
2097 button .t.b -text "Manage This"
2098 pack .t.b
2099 update
2100 lappend result [winfo manage .t.b]
2101 lappend result [winfo toplevel .t.b]
2102 wm manage .t.b
2103 update
2104 lappend result [winfo manage .t.b]
2105 lappend result [winfo toplevel .t.b]
2106 wm forget .t.b
2107 pack .t.b
2108 update
2109 lappend result [winfo manage .t.b]
2110 lappend result [winfo toplevel .t.b]
2111 } -cleanup {
2112 deleteWindows
2113 } -result {pack .t wm .t.b pack .t}
2114 test wm-manage-1.2 {unmanaging a toplevel} -setup {
2097 frame .t.f
2098 pack [label .t.f.l -text hello]
2099 wm manage .t.f
2100 raise .t.f
2101 update
2102 lappend result [winfo manage .t.f]
2103 lappend result [winfo toplevel .t.f]
2104 } -cleanup {
2105 deleteWindows
2106 } -result {wm .t.f}
2107 test wm-manage-1.2 {managing a toplevel} -setup {
2108 set result [list]
2109 } -body {
2110 toplevel .t
2111 pack [label .t.l -text hello]
2112 wm manage .t
2113 raise .t
2114 update
2115 lappend result [winfo manage .t]
2116 lappend result [winfo toplevel .t]
2117 } -cleanup {
2118 deleteWindows
2119 } -result {wm .t}
2120 test wm-manage-1.3 {managing a labelframe} -setup {
2121 set result [list]
2122 } -body {
2123 toplevel .t
2124 labelframe .t.f -text Labelframe
2125 pack [label .t.f.l -text hello]
2126 wm manage .t.f
2127 raise .t.f
2128 update
2129 lappend result [winfo manage .t.f]
2130 lappend result [winfo toplevel .t.f]
2131 } -cleanup {
2132 deleteWindows
2133 } -result {wm .t.f}
2134 test wm-manage-1.4 {managing a ttk::frame} -setup {
2135 set result [list]
2136 } -body {
2137 toplevel .t
2138 ttk::frame .t.f
2139 pack [label .t.f.l -text hello]
2140 wm manage .t.f
2141 raise .t.f
2142 update
2143 lappend result [winfo manage .t.f]
2144 lappend result [winfo toplevel .t.f]
2145 } -cleanup {
2146 deleteWindows
2147 } -returnCodes error -result "window \".t.f\" is not manageable: must be a frame, labelframe or toplevel"
2148 test wm-manage-1.5 {managing a text widget} -setup {
2149 set result [list]
2150 } -body {
2151 toplevel .t
2152 text .t.f
2153 .t.f insert end "Manage text\n" {}
2154 wm manage .t.f
2155 raise .t.f
2156 update
2157 lappend result [winfo manage .t.f]
2158 lappend result [winfo toplevel .t.f]
2159 } -cleanup {
2160 deleteWindows
2161 } -returnCodes error -result "window \".t.f\" is not manageable: must be a frame, labelframe or toplevel"
2162 test wm-manage-1.6 {managing a button} -setup {
2163 set result [list]
2164 } -body {
2165 toplevel .t
2166 button .t.f -text Button
2167 wm manage .t.f
2168 raise .t.f
2169 update
2170 lappend result [winfo manage .t.f]
2171 lappend result [winfo toplevel .t.f]
2172 } -cleanup {
2173 deleteWindows
2174 } -returnCodes error -result "window \".t.f\" is not manageable: must be a frame, labelframe or toplevel"
2175 test wm-manage-1.7 {managing a frame} -setup {
2176 set result [list]
2177 } -body {
2178 toplevel .t
2179 frame .t.f
2180 pack [label .t.f.l -text Label]
2181 pack .t.f
2182 update
2183 lappend result [winfo manage .t.f]
2184 lappend result [winfo toplevel .t.f]
2185 wm manage .t.f
2186 raise .t.f
2187 update
2188 lappend result [winfo manage .t.f]
2189 lappend result [winfo toplevel .t.f]
2190 wm forget .t.f
2191 pack .t.f
2192 update
2193 lappend result [winfo manage .t.f]
2194 lappend result [winfo toplevel .t.f]
2195 } -cleanup {
2196 deleteWindows
2197 } -result {pack .t wm .t.f pack .t}
2198 test wm-manage-1.8 {unmanaging a toplevel} -setup {
21152199 set result [list]
21162200 } -body {
21172201 toplevel .t
21872271 catch {unset results}
21882272 catch {unset focusin}
21892273 return
2274
2275 # Local variables:
2276 # mode: tcl
2277 # End:
44 # "autoconf" program (constructs like "@foo@" will get replaced in the
55 # actual Makefile.
66 #
7 # RCS: @(#) $Id: Makefile.in,v 1.145 2008/08/25 11:44:03 dkf Exp $
7 # RCS: @(#) $Id: Makefile.in,v 1.147 2008/12/05 10:48:52 dkf Exp $
88
99 # Current Tk version; used in various names.
1010
357357 #
358358 FONT_OBJS = @UNIX_FONT_OBJS@
359359
360 GENERIC_OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkClipboard.o \
360 GENERIC_OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkBusy.o \
361 tkClipboard.o \
361362 tkCmds.o tkColor.o tkConfig.o tkConsole.o tkCursor.o tkError.o \
362363 tkEvent.o tkFocus.o tkFont.o tkGet.o tkGC.o tkGeometry.o tkGrab.o \
363364 tkGrid.o tkMain.o tkObj.o tkOldConfig.o tkOption.o tkPack.o tkPlace.o \
411412 GENERIC_SRCS = \
412413 $(GENERIC_DIR)/tk3d.c $(GENERIC_DIR)/tkArgv.c \
413414 $(GENERIC_DIR)/tkAtom.c $(GENERIC_DIR)/tkBind.c \
414 $(GENERIC_DIR)/tkBitmap.c $(GENERIC_DIR)/tkClipboard.c \
415 $(GENERIC_DIR)/tkBitmap.c $(GENERIC_DIR)/tkBusy.c \
416 $(GENERIC_DIR)/tkClipboard.c \
415417 $(GENERIC_DIR)/tkCmds.c $(GENERIC_DIR)/tkColor.c \
416418 $(GENERIC_DIR)/tkConfig.c $(GENERIC_DIR)/tkCursor.c \
417419 $(GENERIC_DIR)/tkError.c $(GENERIC_DIR)/tkEvent.c \
757759 $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"/X11; \
758760 done;
759761 @echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
760 @for i in $(TOP_DIR)/library/*.tcl $(GENERIC_DIR)/prolog.ps \
761 $(TOP_DIR)/library/tclIndex $(UNIX_DIR)/tkAppInit.c; \
762 @for i in $(TOP_DIR)/library/*.tcl $(TOP_DIR)/library/tclIndex \
763 $(UNIX_DIR)/tkAppInit.c; \
762764 do \
763765 $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \
764766 done;
921923 tkBitmap.o: $(GENERIC_DIR)/tkBitmap.c
922924 $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkBitmap.c
923925
926 tkBusy.o: $(GENERIC_DIR)/tkBusy.c
927 $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkBusy.c
928
924929 tkClipboard.o: $(GENERIC_DIR)/tkClipboard.c
925930 $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkClipboard.c
926931
15291534 fi; \
15301535 done;)
15311536 mkdir $(DISTDIR)/generic
1532 cp -p $(GENERIC_DIR)/*.[ch] $(GENERIC_DIR)/prolog.ps $(DISTDIR)/generic
1537 cp -p $(GENERIC_DIR)/*.[ch] $(DISTDIR)/generic
15331538 cp -p $(GENERIC_DIR)/*.decls $(DISTDIR)/generic
15341539 cp -p $(GENERIC_DIR)/README $(DISTDIR)/generic
15351540 cp -p $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog \
13361336 TK_VERSION=8.6
13371337 TK_MAJOR_VERSION=8
13381338 TK_MINOR_VERSION=6
1339 TK_PATCH_LEVEL="a3"
1339 TK_PATCH_LEVEL="b1"
13401340 VERSION=${TK_VERSION}
13411341 LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
13421342
26022602 ac_compiler_gnu=$ac_cv_c_compiler_gnu
26032603
26042604
2605 echo "$as_me:$LINENO: checking for inline" >&5
2606 echo $ECHO_N "checking for inline... $ECHO_C" >&6
2607 if test "${ac_cv_c_inline+set}" = set; then
2608 echo $ECHO_N "(cached) $ECHO_C" >&6
2609 else
2610 ac_cv_c_inline=no
2611 for ac_kw in inline __inline__ __inline; do
2612 cat >conftest.$ac_ext <<_ACEOF
2613 /* confdefs.h. */
2614 _ACEOF
2615 cat confdefs.h >>conftest.$ac_ext
2616 cat >>conftest.$ac_ext <<_ACEOF
2617 /* end confdefs.h. */
2618 #ifndef __cplusplus
2619 typedef int foo_t;
2620 static $ac_kw foo_t static_foo () {return 0; }
2621 $ac_kw foo_t foo () {return 0; }
2622 #endif
2623
2624 _ACEOF
2625 rm -f conftest.$ac_objext
2626 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2627 (eval $ac_compile) 2>conftest.er1
2628 ac_status=$?
2629 grep -v '^ *+' conftest.er1 >conftest.err
2630 rm -f conftest.er1
2631 cat conftest.err >&5
2632 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2633 (exit $ac_status); } &&
2634 { ac_try='test -z "$ac_c_werror_flag"
2635 || test ! -s conftest.err'
2636 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2637 (eval $ac_try) 2>&5
2638 ac_status=$?
2639 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2640 (exit $ac_status); }; } &&
2641 { ac_try='test -s conftest.$ac_objext'
2642 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2643 (eval $ac_try) 2>&5
2644 ac_status=$?
2645 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2646 (exit $ac_status); }; }; then
2647 ac_cv_c_inline=$ac_kw; break
2648 else
2649 echo "$as_me: failed program was:" >&5
2650 sed 's/^/| /' conftest.$ac_ext >&5
2651
2652 fi
2653 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2654 done
2655
2656 fi
2657 echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
2658 echo "${ECHO_T}$ac_cv_c_inline" >&6
2659
2660
2661 case $ac_cv_c_inline in
2662 inline | yes) ;;
2663 *)
2664 case $ac_cv_c_inline in
2665 no) ac_val=;;
2666 *) ac_val=$ac_cv_c_inline;;
2667 esac
2668 cat >>confdefs.h <<_ACEOF
2669 #ifndef __cplusplus
2670 #define inline $ac_val
2671 #endif
2672 _ACEOF
2673 ;;
2674 esac
2675
2676
26052677 # limits header checks must come early to prevent
26062678 # an autoconf bug that throws errors on configure
2607
26082679 ac_ext=c
26092680 ac_cpp='$CPP $CPPFLAGS'
26102681 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
44484519 ECHO_VERSION='`echo ${VERSION}`'
44494520 TCL_LIB_VERSIONS_OK=ok
44504521 CFLAGS_DEBUG=-g
4451 CFLAGS_OPTIMIZE=-O
44524522 if test "$GCC" = yes; then
44534523
4454 CFLAGS_WARNING="-Wall -Wno-implicit-int"
4455
4456 else
4457 CFLAGS_WARNING=""
4524 CFLAGS_OPTIMIZE="-O2"
4525 CFLAGS_WARNING="-Wall"
4526
4527 else
4528
4529 CFLAGS_OPTIMIZE=-O
4530 CFLAGS_WARNING=""
4531
44584532 fi
44594533
44604534 TCL_NEEDS_EXP_FILE=0
49204994 DL_LIBS="-ldld"
49214995 LDFLAGS="$LDFLAGS -Wl,-E"
49224996 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
4923 LD_SEARCH_FLAGS='-Wl,+s +b ${LIB_RUNTIME_DIR}:.'
4997 LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
49244998 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
49254999
49265000 fi
92069280 /usr/openwin/share/include'
92079281
92089282 if test "$ac_x_includes" = no; then
9209 # Guess where to find include files, by looking for Intrinsic.h.
9283 # Guess where to find include files, by looking for Xlib.h.
92109284 # First, try using that file with no special directory specified.
92119285 cat >conftest.$ac_ext <<_ACEOF
92129286 /* confdefs.h. */
92149288 cat confdefs.h >>conftest.$ac_ext
92159289 cat >>conftest.$ac_ext <<_ACEOF
92169290 /* end confdefs.h. */
9217 #include <X11/Intrinsic.h>
9291 #include <X11/Xlib.h>
92189292 _ACEOF
92199293 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
92209294 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
92419315 sed 's/^/| /' conftest.$ac_ext >&5
92429316
92439317 for ac_dir in $ac_x_header_dirs; do
9244 if test -r "$ac_dir/X11/Intrinsic.h"; then
9318 if test -r "$ac_dir/X11/Xlib.h"; then
92459319 ac_x_includes=$ac_dir
92469320 break
92479321 fi
92559329 # See if we find them without any special options.
92569330 # Don't add to $LIBS permanently.
92579331 ac_save_LIBS=$LIBS
9258 LIBS="-lXt $LIBS"
9332 LIBS="-lX11 $LIBS"
92599333 cat >conftest.$ac_ext <<_ACEOF
92609334 /* confdefs.h. */
92619335 _ACEOF
92629336 cat confdefs.h >>conftest.$ac_ext
92639337 cat >>conftest.$ac_ext <<_ACEOF
92649338 /* end confdefs.h. */
9265 #include <X11/Intrinsic.h>
9339 #include <X11/Xlib.h>
92669340 int
92679341 main ()
92689342 {
9269 XtMalloc (0)
9343 XrmInitialize ()
92709344 ;
92719345 return 0;
92729346 }
22 dnl generate the file "configure", which is run during Tk installation
33 dnl to configure the system for the local environment.
44 #
5 # RCS: @(#) $Id: configure.in,v 1.158 2008/08/28 16:29:37 dgp Exp $
5 # RCS: @(#) $Id: configure.in,v 1.161 2008/12/19 14:32:25 dgp Exp $
66
77 AC_INIT([tk],[8.6])
88 AC_PREREQ(2.59)
2626 TK_VERSION=8.6
2727 TK_MAJOR_VERSION=8
2828 TK_MINOR_VERSION=6
29 TK_PATCH_LEVEL="a3"
29 TK_PATCH_LEVEL="b1"
3030 VERSION=${TK_VERSION}
3131 LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
3232
7171 fi
7272
7373 AC_PROG_CC
74 AC_C_INLINE
7475
7576 # limits header checks must come early to prevent
7677 # an autoconf bug that throws errors on configure
11001100 ECHO_VERSION='`echo ${VERSION}`'
11011101 TCL_LIB_VERSIONS_OK=ok
11021102 CFLAGS_DEBUG=-g
1103 CFLAGS_OPTIMIZE=-O
11041103 AS_IF([test "$GCC" = yes], [
1105 CFLAGS_WARNING="-Wall -Wno-implicit-int"
1106 ], [CFLAGS_WARNING=""])
1104 CFLAGS_OPTIMIZE="-O2"
1105 CFLAGS_WARNING="-Wall"
1106 ], [
1107 CFLAGS_OPTIMIZE=-O
1108 CFLAGS_WARNING=""
1109 ])
11071110 TCL_NEEDS_EXP_FILE=0
11081111 TCL_BUILD_EXP_FILE=""
11091112 TCL_EXP_FILE=""
12661269 DL_LIBS="-ldld"
12671270 LDFLAGS="$LDFLAGS -Wl,-E"
12681271 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1269 LD_SEARCH_FLAGS='-Wl,+s +b ${LIB_RUNTIME_DIR}:.'
1272 LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
12701273 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
12711274 ])
12721275 AS_IF([test "$GCC" = yes], [
0 # $Id: tk.spec,v 1.39 2008/08/28 16:29:37 dgp Exp $
0 # $Id: tk.spec,v 1.41 2008/12/19 14:32:25 dgp Exp $
11 # This file is the basis for a binary Tk Linux RPM.
22
33 %{!?directory:%define directory /usr/local}
44
55 Name: tk
66 Summary: Tk graphical toolkit for the Tcl scripting language.
7 Version: 8.6a3
7 Version: 8.6b1
88 Release: 2
99 License: BSD
1010 Group: Development/Languages
203203
204204 /* Define to `int' if <sys/types.h> doesn't define. */
205205 #undef gid_t
206
207 /* Define to `__inline__' or `__inline' if that's what the C compiler
208 calls it, or to nothing if 'inline' is not supported under any name. */
209 #ifndef __cplusplus
210 #undef inline
211 #endif
206212
207213 /* Signed integer type wide enough to hold a pointer. */
208214 #undef intptr_t
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkUnix3d.c,v 1.12 2007/12/13 15:28:50 dgp Exp $
11 * RCS: @(#) $Id: tkUnix3d.c,v 1.13 2008/12/09 22:58:30 dkf Exp $
1212 */
1313
1414 #include "tkInt.h"
378378 */
379379
380380 /*
381 * Compute the dark shadow color
381 * Compute the dark shadow color.
382382 */
383383
384384 r = (int) borderPtr->bgColorPtr->red;
396396 }
397397
398398 /*
399 * Allocate the dark shadow color and its GC
399 * Allocate the dark shadow color and its GC.
400400 */
401401
402402 borderPtr->darkColorPtr = Tk_GetColorByValue(tkwin, &darkColor);
404404 borderPtr->darkGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
405405
406406 /*
407 * Compute the light shadow color
407 * Compute the light shadow color.
408408 */
409409
410410 if (g > MAX_INTENSITY*0.95) {
432432 lightColor.blue = (tmp1 > tmp2) ? tmp1 : tmp2;
433433 }
434434
435 /*
436 * Allocate the light shadow color and its GC
437 */
435 /*
436 * Allocate the light shadow color and its GC.
437 */
438438
439439 borderPtr->lightColorPtr = Tk_GetColorByValue(tkwin, &lightColor);
440440 gcValues.foreground = borderPtr->lightColorPtr->pixel;
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkUnixButton.c,v 1.25 2007/12/13 15:28:50 dgp Exp $
10 * RCS: @(#) $Id: tkUnixButton.c,v 1.26 2008/11/05 22:20:59 nijtmans Exp $
1111 */
1212
1313 #include "tkInt.h"
5656 */
5757
5858 /* XPM */
59 static char *button_images[] = {
59 static const char *button_images[] = {
6060 /* width height ncolors chars_per_pixel */
6161 "52 26 7 1",
6262 /* colors */
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkUnixCursor.c,v 1.14 2008/04/27 22:39:13 dkf Exp $
10 * RCS: @(#) $Id: tkUnixCursor.c,v 1.15 2008/11/05 22:48:58 nijtmans Exp $
1111 */
1212
1313 #include "tkInt.h"
162162
163163 static const struct TkCursorName {
164164 const char *name;
165 char *data;
165 const char *data;
166166 char *mask;
167167 } tkCursorNames[] = {
168168 {"none", CURSOR_NONE_DATA, NULL},
183183 static Cursor CreateCursorFromTableOrFile(Tcl_Interp *interp,
184184 Tk_Window tkwin, int argc, const char **argv,
185185 const struct TkCursorName *tkCursorPtr);
186
186
187187 /*
188188 *----------------------------------------------------------------------
189189 *
549549 }
550550 return cursor;
551551 }
552
552
553553 /*
554554 *----------------------------------------------------------------------
555555 *
599599 }
600600 return (TkCursor *) cursorPtr;
601601 }
602
602
603603 /*
604604 *----------------------------------------------------------------------
605605 *
626626 XFreeCursor(unixCursorPtr->display, (Cursor) unixCursorPtr->info.cursor);
627627 Tk_FreeXId(unixCursorPtr->display, (XID) unixCursorPtr->info.cursor);
628628 }
629
629
630630 /*
631631 * Local Variables:
632632 * mode: c
99 * See the file "license.terms" for information on usage and redistribution
1010 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkUnixDefault.h,v 1.26 2007/12/13 15:28:50 dgp Exp $
12 * RCS: @(#) $Id: tkUnixDefault.h,v 1.28 2008/12/06 10:48:29 dkf Exp $
1313 */
1414
1515 #ifndef _TKUNIXDEFAULT
6565 #define DEF_BUTTON_HIGHLIGHT BLACK
6666 #define DEF_LABEL_HIGHLIGHT_WIDTH "0"
6767 #define DEF_BUTTON_HIGHLIGHT_WIDTH "1"
68 #define DEF_BUTTON_IMAGE (char *) NULL
68 #define DEF_BUTTON_IMAGE ((char *) NULL)
6969 #define DEF_BUTTON_INDICATOR "1"
7070 #define DEF_BUTTON_JUSTIFY "center"
7171 #define DEF_BUTTON_OFF_VALUE "0"
8282 #define DEF_BUTTON_REPEAT_INTERVAL "0"
8383 #define DEF_BUTTON_SELECT_COLOR CHECK_INDICATOR
8484 #define DEF_BUTTON_SELECT_MONO BLACK
85 #define DEF_BUTTON_SELECT_IMAGE (char *) NULL
85 #define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
8686 #define DEF_BUTTON_STATE "normal"
8787 #define DEF_LABEL_TAKE_FOCUS "0"
88 #define DEF_BUTTON_TAKE_FOCUS (char *) NULL
88 #define DEF_BUTTON_TAKE_FOCUS ((char *) NULL)
8989 #define DEF_BUTTON_TEXT ""
9090 #define DEF_BUTTON_TEXT_VARIABLE ""
9191 #define DEF_BUTTON_UNDERLINE "-1"
123123 #define DEF_CANVAS_SELECT_BD_MONO "0"
124124 #define DEF_CANVAS_SELECT_FG_COLOR BLACK
125125 #define DEF_CANVAS_SELECT_FG_MONO WHITE
126 #define DEF_CANVAS_TAKE_FOCUS (char *) NULL
126 #define DEF_CANVAS_TAKE_FOCUS ((char *) NULL)
127127 #define DEF_CANVAS_WIDTH "10c"
128128 #define DEF_CANVAS_X_SCROLL_CMD ""
129129 #define DEF_CANVAS_X_SCROLL_INCREMENT "0"
164164 #define DEF_ENTRY_SELECT_BD_MONO "0"
165165 #define DEF_ENTRY_SELECT_FG_COLOR BLACK
166166 #define DEF_ENTRY_SELECT_FG_MONO WHITE
167 #define DEF_ENTRY_SHOW (char *) NULL
167 #define DEF_ENTRY_SHOW ((char *) NULL)
168168 #define DEF_ENTRY_STATE "normal"
169 #define DEF_ENTRY_TAKE_FOCUS (char *) NULL
169 #define DEF_ENTRY_TAKE_FOCUS ((char *) NULL)
170170 #define DEF_ENTRY_TEXT_VARIABLE ""
171171 #define DEF_ENTRY_WIDTH "20"
172172
233233 #define DEF_LISTBOX_SELECT_MODE "browse"
234234 #define DEF_LISTBOX_SET_GRID "0"
235235 #define DEF_LISTBOX_STATE "normal"
236 #define DEF_LISTBOX_TAKE_FOCUS (char *) NULL
236 #define DEF_LISTBOX_TAKE_FOCUS ((char *) NULL)
237237 #define DEF_LISTBOX_WIDTH "20"
238238
239239 /*
240240 * Defaults for individual entries of menus:
241241 */
242242
243 #define DEF_MENU_ENTRY_ACTIVE_BG (char *) NULL
244 #define DEF_MENU_ENTRY_ACTIVE_FG (char *) NULL
245 #define DEF_MENU_ENTRY_ACCELERATOR (char *) NULL
246 #define DEF_MENU_ENTRY_BG (char *) NULL
243 #define DEF_MENU_ENTRY_ACTIVE_BG ((char *) NULL)
244 #define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL)
245 #define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL)
246 #define DEF_MENU_ENTRY_BG ((char *) NULL)
247247 #define DEF_MENU_ENTRY_BITMAP None
248248 #define DEF_MENU_ENTRY_COLUMN_BREAK "0"
249 #define DEF_MENU_ENTRY_COMMAND (char *) NULL
249 #define DEF_MENU_ENTRY_COMMAND ((char *) NULL)
250250 #define DEF_MENU_ENTRY_COMPOUND "none"
251 #define DEF_MENU_ENTRY_FG (char *) NULL
252 #define DEF_MENU_ENTRY_FONT (char *) NULL
251 #define DEF_MENU_ENTRY_FG ((char *) NULL)
252 #define DEF_MENU_ENTRY_FONT ((char *) NULL)
253253 #define DEF_MENU_ENTRY_HIDE_MARGIN "0"
254 #define DEF_MENU_ENTRY_IMAGE (char *) NULL
254 #define DEF_MENU_ENTRY_IMAGE ((char *) NULL)
255255 #define DEF_MENU_ENTRY_INDICATOR "1"
256 #define DEF_MENU_ENTRY_LABEL (char *) NULL
257 #define DEF_MENU_ENTRY_MENU (char *) NULL
256 #define DEF_MENU_ENTRY_LABEL ((char *) NULL)
257 #define DEF_MENU_ENTRY_MENU ((char *) NULL)
258258 #define DEF_MENU_ENTRY_OFF_VALUE "0"
259259 #define DEF_MENU_ENTRY_ON_VALUE "1"
260 #define DEF_MENU_ENTRY_SELECT_IMAGE (char *) NULL
260 #define DEF_MENU_ENTRY_SELECT_IMAGE ((char *) NULL)
261261 #define DEF_MENU_ENTRY_STATE "normal"
262 #define DEF_MENU_ENTRY_VALUE (char *) NULL
263 #define DEF_MENU_ENTRY_CHECK_VARIABLE (char *) NULL
262 #define DEF_MENU_ENTRY_VALUE ((char *) NULL)
263 #define DEF_MENU_ENTRY_CHECK_VARIABLE ((char *) NULL)
264264 #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
265 #define DEF_MENU_ENTRY_SELECT (char *) NULL
265 #define DEF_MENU_ENTRY_SELECT ((char *) NULL)
266266 #define DEF_MENU_ENTRY_UNDERLINE "-1"
267267
268268 /*
288288 #define DEF_MENU_SELECT_MONO BLACK
289289 #define DEF_MENU_TAKE_FOCUS "0"
290290 #define DEF_MENU_TEAROFF "1"
291 #define DEF_MENU_TEAROFF_CMD (char *) NULL
291 #define DEF_MENU_TEAROFF_CMD ((char *) NULL)
292292 #define DEF_MENU_TITLE ""
293293 #define DEF_MENU_TYPE "normal"
294294
316316 #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
317317 #define DEF_MENUBUTTON_HIGHLIGHT BLACK
318318 #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
319 #define DEF_MENUBUTTON_IMAGE (char *) NULL
319 #define DEF_MENUBUTTON_IMAGE ((char *) NULL)
320320 #define DEF_MENUBUTTON_INDICATOR "0"
321321 #define DEF_MENUBUTTON_JUSTIFY "center"
322322 #define DEF_MENUBUTTON_MENU ""
416416 #define DEF_SCALE_LENGTH "100"
417417 #define DEF_SCALE_ORIENT "vertical"
418418 #define DEF_SCALE_RELIEF "flat"
419 #define DEF_SCALE_REPEAT_DELAY "300"
419 #define DEF_SCALE_REPEAT_DELAY "300"
420420 #define DEF_SCALE_REPEAT_INTERVAL "100"
421421 #define DEF_SCALE_RESOLUTION "1"
422422 #define DEF_SCALE_TROUGH_COLOR TROUGH
425425 #define DEF_SCALE_SLIDER_LENGTH "30"
426426 #define DEF_SCALE_SLIDER_RELIEF "raised"
427427 #define DEF_SCALE_STATE "normal"
428 #define DEF_SCALE_TAKE_FOCUS (char *) NULL
428 #define DEF_SCALE_TAKE_FOCUS ((char *) NULL)
429429 #define DEF_SCALE_TICK_INTERVAL "0"
430430 #define DEF_SCALE_TO "100"
431431 #define DEF_SCALE_VARIABLE ""
452452 #define DEF_SCROLLBAR_RELIEF "sunken"
453453 #define DEF_SCROLLBAR_REPEAT_DELAY "300"
454454 #define DEF_SCROLLBAR_REPEAT_INTERVAL "100"
455 #define DEF_SCROLLBAR_TAKE_FOCUS (char *) NULL
455 #define DEF_SCROLLBAR_TAKE_FOCUS ((char *) NULL)
456456 #define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
457457 #define DEF_SCROLLBAR_TROUGH_MONO WHITE
458458 #define DEF_SCROLLBAR_WIDTH "11"
479479 #define DEF_TEXT_INSERT_BD_MONO "0"
480480 #define DEF_TEXT_INSERT_OFF_TIME "300"
481481 #define DEF_TEXT_INSERT_ON_TIME "600"
482 #define DEF_TEXT_INSERT_UNFOCUSSED "none"
482483 #define DEF_TEXT_INSERT_WIDTH "2"
483 #define DEF_TEXT_MAX_UNDO "0"
484 #define DEF_TEXT_MAX_UNDO "0"
484485 #define DEF_TEXT_PADX "1"
485486 #define DEF_TEXT_PADY "1"
486487 #define DEF_TEXT_RELIEF "sunken"
499500 #define DEF_TEXT_STATE "normal"
500501 #define DEF_TEXT_TABS ""
501502 #define DEF_TEXT_TABSTYLE "tabular"
502 #define DEF_TEXT_TAKE_FOCUS (char *) NULL
503 #define DEF_TEXT_UNDO "0"
503 #define DEF_TEXT_TAKE_FOCUS ((char *) NULL)
504 #define DEF_TEXT_UNDO "0"
504505 #define DEF_TEXT_WIDTH "80"
505506 #define DEF_TEXT_WRAP "char"
506507 #define DEF_TEXT_XSCROLL_COMMAND ""
522523 #define DEF_TOPLEVEL_SCREEN ""
523524 #define DEF_TOPLEVEL_USE ""
524525
526 /*
527 * Defaults for busy windows:
528 */
529
530 #define DEF_BUSY_CURSOR "watch"
531
525532 #endif /* _TKUNIXDEFAULT */
33 * This file contains platform-specific functions for UNIX to provide
44 * basic operations needed for application embedding (where one
55 * application can use as its main window an internal window from some
6 * other application).
6 * other application). Also includes code to support busy windows.
77 *
88 * Copyright (c) 1996-1997 Sun Microsystems, Inc.
99 *
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkUnixEmbed.c,v 1.13 2008/04/27 22:39:13 dkf Exp $
13 * RCS: @(#) $Id: tkUnixEmbed.c,v 1.14 2008/10/20 10:50:20 dkf Exp $
1414 */
1515
1616 #include "tkUnixInt.h"
17 #include "tkBusy.h"
1718
1819 /*
1920 * One of the following structures exists for each container in this
10141015 }
10151016
10161017 /*
1018 *----------------------------------------------------------------------
1019 *
1020 * TkpShowBusyWindow --
1021 *
1022 * Makes a busy window "appear".
1023 *
1024 * Results:
1025 * None.
1026 *
1027 * Side effects:
1028 * Arranges for the busy window to start intercepting events and the
1029 * cursor to change to the configured "hey, I'm busy!" setting.
1030 *
1031 *----------------------------------------------------------------------
1032 */
1033
1034 void
1035 TkpShowBusyWindow(
1036 TkBusy busy)
1037 {
1038 Busy *busyPtr = (Busy *) busy;
1039
1040 if (busyPtr->tkBusy != NULL) {
1041 Tk_MapWindow(busyPtr->tkBusy);
1042
1043 /*
1044 * Always raise the busy window just in case new sibling windows have
1045 * been created in the meantime. Can't use Tk_RestackWindow because it
1046 * doesn't work under Win32.
1047 */
1048
1049 XRaiseWindow(Tk_Display(busyPtr->tkBusy),
1050 Tk_WindowId(busyPtr->tkBusy));
1051 }
1052 }
1053
1054 /*
1055 *----------------------------------------------------------------------
1056 *
1057 * TkpHideBusyWindow --
1058 *
1059 * Makes a busy window "disappear".
1060 *
1061 * Results:
1062 * None.
1063 *
1064 * Side effects:
1065 * Arranges for the busy window to stop intercepting events, and the
1066 * cursor to change back to its normal setting.
1067 *
1068 *----------------------------------------------------------------------
1069 */
1070
1071 void
1072 TkpHideBusyWindow(
1073 TkBusy busy)
1074 {
1075 Busy *busyPtr = (Busy *) busy;
1076
1077 if (busyPtr->tkBusy != NULL) {
1078 Tk_UnmapWindow(busyPtr->tkBusy);
1079 }
1080 }
1081
1082 /*
1083 *----------------------------------------------------------------------
1084 *
1085 * TkpMakeTransparentWindowExist --
1086 *
1087 * Construct the platform-specific resources for a transparent window.
1088 *
1089 * Results:
1090 * None.
1091 *
1092 * Side effects:
1093 * Moves the specified window in the stacking order.
1094 *
1095 *----------------------------------------------------------------------
1096 */
1097
1098 void
1099 TkpMakeTransparentWindowExist(
1100 Tk_Window tkwin, /* Token for window. */
1101 Window parent) /* Parent window. */
1102 {
1103 TkWindow *winPtr = (TkWindow *) tkwin;
1104 long int mask = CWDontPropagate | CWEventMask;
1105
1106 /*
1107 * Ignore the important events while the window is mapped.
1108 */
1109
1110 #define USER_EVENTS \
1111 (EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask | \
1112 ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
1113 #define PROP_EVENTS \
1114 (KeyPressMask | KeyReleaseMask | ButtonPressMask | \
1115 ButtonReleaseMask | PointerMotionMask)
1116
1117 winPtr->atts.do_not_propagate_mask = PROP_EVENTS;
1118 winPtr->atts.event_mask = USER_EVENTS;
1119 winPtr->changes.border_width = 0;
1120 winPtr->depth = 0;
1121
1122 winPtr->window = XCreateWindow(winPtr->display, parent,
1123 winPtr->changes.x, winPtr->changes.y,
1124 (unsigned) winPtr->changes.width, /* width */
1125 (unsigned) winPtr->changes.height, /* height */
1126 (unsigned) winPtr->changes.border_width, /* border_width */
1127 winPtr->depth, InputOnly, winPtr->visual, mask, &winPtr->atts);
1128 }
1129
1130 /*
1131 *----------------------------------------------------------------------
1132 *
1133 * TkpCreateBusy --
1134 *
1135 * Construct the platform-specific parts of a busy window. Note that this
1136 * postpones the actual creation of the window resource until later. The
1137 * GetParent() function is a helper for this.
1138 *
1139 * Results:
1140 * None.
1141 *
1142 * Side effects:
1143 * Sets up part of the busy window structure.
1144 *
1145 *----------------------------------------------------------------------
1146 */
1147
1148 static inline Window
1149 GetParent(
1150 Display *display,
1151 Window window)
1152 {
1153 Window root, parent;
1154 Window *dummy;
1155 unsigned int count;
1156
1157 if (XQueryTree(display, window, &root, &parent, &dummy, &count) > 0) {
1158 XFree(dummy);
1159 return parent;
1160 }
1161 return None;
1162 }
1163
1164 void
1165 TkpCreateBusy(
1166 Tk_FakeWin *winPtr,
1167 Tk_Window tkRef,
1168 Window *parentPtr,
1169 Tk_Window tkParent,
1170 TkBusy busy)
1171 {
1172 if (winPtr->flags & TK_REPARENTED) {
1173 /*
1174 * This works around a bug in the implementation of menubars for
1175 * non-MacIntosh window systems (Win32 and X11). Tk doesn't reset the
1176 * pointers to the parent window when the menu is reparented (since
1177 * winPtr->parentPtr points to the wrong window). We get around this
1178 * by determining the parent via the native API calls.
1179 */
1180
1181 *parentPtr = GetParent(Tk_Display(tkRef), Tk_WindowId(tkRef));
1182 } else {
1183 *parentPtr = Tk_WindowId(tkParent);
1184 }
1185 }
1186
1187 /*
10171188 * Local Variables:
10181189 * mode: c
10191190 * c-basic-offset: 4
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkUnixEvent.c,v 1.30 2008/10/05 18:22:21 dkf Exp $
11 * RCS: @(#) $Id: tkUnixEvent.c,v 1.31 2008/10/22 16:30:16 das Exp $
1212 */
1313
1414 #include "tkUnixInt.h"
290290 if (event.type == GenericEvent) {
291291 xGenericEvent *xgePtr = (xGenericEvent *) &event;
292292
293 Tcl_Panic("Wild GenericEvent; panic! (extension=%d,evtype=%d)"
293 Tcl_Panic("Wild GenericEvent; panic! (extension=%d,evtype=%d)",
294294 xgePtr->extension, xgePtr->evtype);
295295 }
296296 #endif
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkUnixFont.c,v 1.35 2008/10/05 18:22:21 dkf Exp $
11 * RCS: @(#) $Id: tkUnixFont.c,v 1.39 2008/11/22 18:08:51 dkf Exp $
1212 */
1313
1414 #include "tkUnixInt.h"
2020 * The preferred font encodings.
2121 */
2222
23 static const char *encodingList[] = {
23 static const char *const encodingList[] = {
2424 "iso8859-1", "jis0208", "jis0212", NULL
2525 };
2626
138138 */
139139
140140 typedef struct EncodingAlias {
141 char *realName; /* The real name of the encoding to load if
141 const char *realName; /* The real name of the encoding to load if
142142 * the provided name matched the pattern. */
143 char *aliasPattern; /* Pattern for encoding name, of the form that
143 const char *aliasPattern; /* Pattern for encoding name, of the form that
144144 * is acceptable to Tcl_StringMatch. */
145145 } EncodingAlias;
146146
209209 const char *fallbackName, int ch,
210210 SubFont **fixSubFontPtrPtr);
211211 static SubFont * CanUseFallbackWithAliases(UnixFont *fontPtr,
212 char *fallbackName, int ch,
212 const char *fallbackName, int ch,
213213 Tcl_DString *nameTriedPtr,
214214 SubFont **fixSubFontPtrPtr);
215215 static int ControlUtfProc(ClientData clientData, const char *src,
14821482
14831483 nameList = ListFontOrAlias(display, want.fa.family, &numNames);
14841484 if (numNames == 0) {
1485 char ***fontFallbacks;
1485 const char *const *const *fontFallbacks;
14861486 int i, j;
1487 char *fallback;
1487 const char *fallback;
14881488
14891489 fontFallbacks = TkFontGetFallbacks();
14901490 for (i = 0; fontFallbacks[i] != NULL; i++) {
19681968 {
19691969 int i, j, k, numNames;
19701970 Tk_Uid faceName;
1971 char *fallback, **aliases, **nameList, **anyFallbacks, ***fontFallbacks;
1971 const char *fallback;
1972 const char *const *aliases;
1973 char **nameList;
1974 const char *const *anyFallbacks;
1975 const char *const *const *fontFallbacks;
19721976 SubFont *subFontPtr;
19731977 Tcl_DString ds;
19741978
22862290 CanUseFallbackWithAliases(
22872291 UnixFont *fontPtr, /* The font object that will own the new
22882292 * screen font. */
2289 char *faceName, /* Desired face name for new screen font. */
2293 const char *faceName, /* Desired face name for new screen font. */
22902294 int ch, /* The Unicode character that the new screen
22912295 * font must be able to display. */
22922296 Tcl_DString *nameTriedPtr, /* Records face names that have already been
22972301 * reallocate our subfont table. */
22982302 {
22992303 SubFont *subFontPtr;
2300 char **aliases;
2304 const char *const *aliases;
23012305 int i;
23022306
23032307 if (SeenName(faceName, nameTriedPtr) == 0) {
24012405 Tk_Uid hateFoundry;
24022406 const char *charset, *hateCharset;
24032407 unsigned bestScore[2];
2404 char **nameList, **nameListOrig, src[TCL_UTF_MAX];
2408 char **nameList;
2409 char **nameListOrig;
2410 char src[TCL_UTF_MAX];
24052411 FontAttributes want, got;
24062412 Display *display;
24072413 SubFont subFont;
29062912 int *numNamesPtr) /* Filled with length of returned array, or 0
29072913 * if no names were found. */
29082914 {
2909 char **nameList, **aliases;
2915 char **nameList;
2916 const char *const *aliases;
29102917 int i;
29112918
29122919 nameList = ListFonts(display, faceName, numNamesPtr);
29552962 FontAttributes *faPtr)
29562963 {
29572964 int i, j;
2958 char **aliases, **symbolClass;
2965 const char *const *aliases;
2966 const char *const *symbolClass;
29592967
29602968 symbolClass = TkFontGetSymbolClass();
29612969 for (i = 0; symbolClass[i] != NULL; i++) {
30093017 return name;
30103018 }
30113019
3020 static inline XImage *
3021 GetImageOfText(
3022 Display *display, /* Display on which to draw. */
3023 Drawable drawable, /* Window or pixmap in which to draw. */
3024 Tk_Font tkfont, /* Font in which characters will be drawn. */
3025 const char *source, /* UTF-8 string to be displayed. Need not be
3026 * '\0' terminated. All Tk meta-characters
3027 * (tabs, control characters, and newlines)
3028 * should be stripped out of the string that
3029 * is passed to this function. If they are not
3030 * stripped out, they will be displayed as
3031 * regular printing characters. */
3032 int numBytes, /* Number of bytes in string. */
3033 int *realWidthPtr, int *realHeightPtr)
3034 {
3035 int width, height;
3036 TkFont *fontPtr = (TkFont *) tkfont;
3037 Pixmap bitmap;
3038 GC bitmapGC;
3039 XGCValues values;
3040 XImage *image;
3041
3042 (void) Tk_MeasureChars(tkfont, source, numBytes, -1, 0, &width);
3043 height = fontPtr->fm.ascent + fontPtr->fm.descent;
3044
3045 bitmap = Tk_GetPixmap(display, drawable, width, height, 1);
3046 values.graphics_exposures = False;
3047 values.foreground = BlackPixel(display, DefaultScreen(display));
3048 bitmapGC = XCreateGC(display, bitmap, GCGraphicsExposures|GCForeground,
3049 &values);
3050 XFillRectangle(display, bitmap, bitmapGC, 0, 0, width, height);
3051
3052 values.font = Tk_FontId(tkfont);
3053 values.foreground = WhitePixel(display, DefaultScreen(display));
3054 values.background = BlackPixel(display, DefaultScreen(display));
3055 XChangeGC(display, bitmapGC, GCFont|GCForeground|GCBackground, &values);
3056 Tk_DrawChars(display, bitmap, bitmapGC, tkfont, source, numBytes, 0,
3057 fontPtr->fm.ascent);
3058 XFreeGC(display, bitmapGC);
3059
3060 image = XGetImage(display, bitmap, 0, 0, width, height, AllPlanes,
3061 ZPixmap);
3062 Tk_FreePixmap(display, bitmap);
3063
3064 *realWidthPtr = width;
3065 *realHeightPtr = height;
3066 return image;
3067 }
3068
3069 static inline XImage *
3070 InitDestImage(
3071 Display *display,
3072 Drawable drawable,
3073 int width,
3074 int height,
3075 Pixmap *bitmapPtr)
3076 {
3077 Pixmap bitmap;
3078 XImage *image;
3079 GC bitmapGC;
3080 XGCValues values;
3081
3082 bitmap = Tk_GetPixmap(display, drawable, width, height, 1);
3083 values.graphics_exposures = False;
3084 values.foreground = BlackPixel(display, DefaultScreen(display));
3085 bitmapGC = XCreateGC(display, bitmap, GCGraphicsExposures|GCForeground,
3086 &values);
3087 XFillRectangle(display, bitmap, bitmapGC, 0, 0, width, height);
3088 XFreeGC(display, bitmapGC);
3089
3090 image = XGetImage(display, bitmap, 0, 0, width, height, AllPlanes,
3091 ZPixmap);
3092 *bitmapPtr = bitmap;
3093 return image;
3094 }
3095
3096 void
3097 TkpDrawAngledChars(
3098 Display *display, /* Display on which to draw. */
3099 Drawable drawable, /* Window or pixmap in which to draw. */
3100 GC gc, /* Graphics context for drawing characters. */
3101 Tk_Font tkfont, /* Font in which characters will be drawn;
3102 * must be the same as font used in GC. */
3103 const char *source, /* UTF-8 string to be displayed. Need not be
3104 * '\0' terminated. All Tk meta-characters
3105 * (tabs, control characters, and newlines)
3106 * should be stripped out of the string that
3107 * is passed to this function. If they are not
3108 * stripped out, they will be displayed as
3109 * regular printing characters. */
3110 int numBytes, /* Number of bytes in string. */
3111 double x, double y,
3112 double angle)
3113 {
3114 if (angle == 0.0) {
3115 Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y);
3116 } else {
3117 double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
3118 int bufHeight, bufWidth, srcWidth, srcHeight, i, j, dx, dy;
3119 Pixmap buf;
3120 XImage *srcImage = GetImageOfText(display, drawable, tkfont, source,
3121 numBytes, &srcWidth, &srcHeight);
3122 XImage *dstImage;
3123 enum {Q0=1,R1,Q1,R2,Q2,R3,Q3} quadrant;
3124 GC bwgc, cpgc;
3125 XGCValues values;
3126 int ascent = ((TkFont *) tkfont)->fm.ascent;
3127
3128 /*
3129 * First, work out what quadrant we are operating in. We also handle
3130 * the rectilinear rotations as special cases. Conceptually, there's
3131 * also R0 (angle == 0.0) but that has been already handled as a
3132 * special case above.
3133 *
3134 * R1
3135 * Q1 | Q0
3136 * |
3137 * R2 ----+---- R0
3138 * |
3139 * Q2 | Q3
3140 * R3
3141 */
3142
3143 if (angle < 90.0) {
3144 quadrant = Q0;
3145 } else if (angle == 90.0) {
3146 quadrant = R1;
3147 } else if (angle < 180.0) {
3148 quadrant = Q1;
3149 } else if (angle == 180.0) {
3150 quadrant = R2;
3151 } else if (angle < 270.0) {
3152 quadrant = Q2;
3153 } else if (angle == 270.0) {
3154 quadrant = R3;
3155 } else {
3156 quadrant = Q3;
3157 }
3158
3159 if (srcImage == NULL) {
3160 return;
3161 }
3162 bufWidth = srcWidth*fabs(cosA) + srcHeight*fabs(sinA);
3163 bufHeight = srcHeight*fabs(cosA) + srcWidth*fabs(sinA);
3164 dstImage = InitDestImage(display, drawable, bufWidth,bufHeight, &buf);
3165 if (dstImage == NULL) {
3166 Tk_FreePixmap(display, buf);
3167 XDestroyImage(srcImage);
3168 return;
3169 }
3170
3171 /*
3172 * Do the rotation, setting or resetting pixels in the destination
3173 * image dependent on whether the corresponding pixel (after rotation
3174 * to source image space) is set.
3175 */
3176
3177 for (i=0 ; i<srcWidth ; i++) {
3178 for (j=0 ; j<srcHeight ; j++) {
3179 switch (quadrant) {
3180 case Q0:
3181 dx = floor(i*cosA + j*sinA + 0.5);
3182 dy = floor(j*cosA + (srcWidth - i)*sinA + 0.5);
3183 break;
3184 case R1:
3185 dx = j;
3186 dy = srcWidth - i;
3187 break;
3188 case Q1:
3189 dx = floor((i - srcWidth)*cosA + j*sinA + 0.5);
3190 dy = floor((srcWidth-i)*sinA + (j-srcHeight)*cosA + 0.5);
3191 break;
3192 case R2:
3193 dx = srcWidth - i;
3194 dy = srcHeight - j;
3195 break;
3196 case Q2:
3197 dx = floor((i-srcWidth)*cosA + (j-srcHeight)*sinA + 0.5);
3198 dy = floor((j - srcHeight)*cosA - i*sinA + 0.5);
3199 break;
3200 case R3:
3201 dx = srcHeight - j;
3202 dy = i;
3203 break;
3204 default:
3205 dx = floor(i*cosA + (j - srcHeight)*sinA + 0.5);
3206 dy = floor(j*cosA - i*sinA + 0.5);
3207 }
3208
3209 if (dx < 0 || dy < 0 || dx >= bufWidth || dy >= bufHeight) {
3210 continue;
3211 }
3212 XPutPixel(dstImage, dx, dy,
3213 XGetPixel(dstImage,dx,dy) | XGetPixel(srcImage,i,j));
3214 }
3215 }
3216 XDestroyImage(srcImage);
3217
3218 /*
3219 * Schlep the data back to the Xserver.
3220 */
3221
3222 values.function = GXcopy;
3223 values.foreground = WhitePixel(display, DefaultScreen(display));
3224 values.background = BlackPixel(display, DefaultScreen(display));
3225 bwgc = XCreateGC(display, buf, GCFunction|GCForeground|GCBackground,
3226 &values);
3227 XPutImage(display, buf, bwgc, dstImage, 0,0, 0,0, bufWidth,bufHeight);
3228 XFreeGC(display, bwgc);
3229 XDestroyImage(dstImage);
3230
3231 /*
3232 * Calculate where we want to draw the text.
3233 */
3234
3235 switch (quadrant) {
3236 case Q0:
3237 dx = x;
3238 dy = y - srcWidth*sinA;
3239 break;
3240 case R1:
3241 dx = x;
3242 dy = y - srcWidth;
3243 break;
3244 case Q1:
3245 dx = x + srcWidth*cosA;
3246 dy = y + srcHeight*cosA - srcWidth*sinA;
3247 break;
3248 case R2:
3249 dx = x - srcWidth;
3250 dy = y - srcHeight;
3251 break;
3252 case Q2:
3253 dx = x + srcWidth*cosA + srcHeight*sinA;
3254 dy = y + srcHeight*cosA;
3255 break;
3256 case R3:
3257 dx = x - srcHeight;
3258 dy = y;
3259 break;
3260 default:
3261 dx = x + srcHeight*sinA;
3262 dy = y;
3263 }
3264
3265 /*
3266 * Apply a correction to deal with the fact that we aren't told to
3267 * draw from our top-left corner but rather from the left-end of our
3268 * baseline.
3269 */
3270
3271 dx -= ascent*sinA;
3272 dy -= ascent*cosA;
3273
3274 /*
3275 * Transfer the text to the screen. This is done by using it as a mask
3276 * and then drawing through that mask with the original drawing color.
3277 */
3278
3279 values.function = GXcopy;
3280 values.fill_style = FillSolid;
3281 values.clip_mask = buf;
3282 values.clip_x_origin = dx;
3283 values.clip_y_origin = dy;
3284 cpgc = XCreateGC(display, drawable,
3285 GCFunction|GCFillStyle|GCClipMask|GCClipXOrigin|GCClipYOrigin,
3286 &values);
3287 XCopyGC(display, gc, GCForeground, cpgc);
3288 XFillRectangle(display, drawable, cpgc, dx, dy, bufWidth,
3289 bufHeight);
3290 XFreeGC(display, cpgc);
3291
3292 Tk_FreePixmap(display, buf);
3293 return;
3294 }
3295 }
3296
30123297 /*
30133298 * Local Variables:
30143299 * mode: c
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkUnixKey.c,v 1.14 2008/06/11 00:41:43 jenglish Exp $
11 * RCS: @(#) $Id: tkUnixKey.c,v 1.15 2008/11/26 15:56:37 dkf Exp $
1212 */
1313
1414 #include "tkInt.h"
2323 * Tk_SetCaretPos --
2424 *
2525 * This enables correct placement of the XIM caret. This is called by
26 * widgets to indicate their cursor placement. This is currently only
26 * widgets to indicate their cursor placement. This is currently only
2727 * used for over-the-spot XIM.
2828 *
2929 *----------------------------------------------------------------------
3939 TkWindow *winPtr = (TkWindow *) tkwin;
4040 TkDisplay *dispPtr = winPtr->dispPtr;
4141
42 if ( dispPtr->caret.winPtr == winPtr
43 && dispPtr->caret.x == x
44 && dispPtr->caret.y == y
45 && dispPtr->caret.height == height)
46 {
42 if ((dispPtr->caret.winPtr == winPtr)
43 && (dispPtr->caret.x == x)
44 && (dispPtr->caret.y == y)
45 && (dispPtr->caret.height == height)) {
4746 return;
4847 }
4948
5251 dispPtr->caret.y = y;
5352 dispPtr->caret.height = height;
5453
54 /*
55 * Adjust the XIM caret position.
56 */
57
5558 #ifdef TK_USE_INPUT_METHODS
56 /*
57 * Adjust the XIM caret position.
58 */
59 if ( (dispPtr->flags & TK_DISPLAY_USE_IM)
60 && (dispPtr->inputStyle & XIMPreeditPosition)
61 && (winPtr->inputContext != NULL) )
62 {
59 if ((dispPtr->flags & TK_DISPLAY_USE_IM)
60 && (dispPtr->inputStyle & XIMPreeditPosition)
61 && (winPtr->inputContext != NULL)) {
6362 XVaNestedList preedit_attr;
6463 XPoint spot;
6564
6665 spot.x = dispPtr->caret.x;
6766 spot.y = dispPtr->caret.y + dispPtr->caret.height;
6867 preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
69 XSetICValues(winPtr->inputContext,
70 XNPreeditAttributes, preedit_attr,
68 XSetICValues(winPtr->inputContext, XNPreeditAttributes, preedit_attr,
7169 NULL);
7270 XFree(preedit_attr);
7371 }
8179 *
8280 * Convert a keyboard event to a UTF-8 string using XLookupString.
8381 *
84 * This is used as a fallback instead of Xutf8LookupString
85 * or XmbLookupString if input methods are turned off
86 * and for KeyRelease events.
82 * This is used as a fallback instead of Xutf8LookupString or
83 * XmbLookupString if input methods are turned off and for KeyRelease
84 * events.
8785 *
8886 * Notes:
89 * XLookupString() normally returns a single ISO Latin 1
90 * or ASCII control character.
87 * XLookupString() normally returns a single ISO Latin 1 or ASCII control
88 * character.
9189 *
9290 *----------------------------------------------------------------------
9391 */
103101 buf[len] = '\0';
104102
105103 if (len == 1) {
106 len = Tcl_UniCharToUtf((unsigned char)buf[0], Tcl_DStringValue(dsPtr));
104 len = Tcl_UniCharToUtf((unsigned char) buf[0],
105 Tcl_DStringValue(dsPtr));
107106 Tcl_DStringSetLength(dsPtr, len);
108107 } else {
109108 /*
110109 * len > 1 should only happen if someone has called XRebindKeysym().
111110 * Assume UTF-8.
112111 */
112
113113 Tcl_DStringSetLength(dsPtr, len);
114114 strncpy(Tcl_DStringValue(dsPtr), buf, len);
115115 }
139139 TkWindow *winPtr, /* Window where event occurred */
140140 XEvent *eventPtr, /* X keyboard event. */
141141 Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */
142 {
142143 #ifdef TK_USE_INPUT_METHODS
143 #if X_HAVE_UTF8_STRING
144 {
145144 if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)
146145 && (winPtr->inputContext != NULL)
147 && (eventPtr->type == KeyPress))
148 {
146 && (eventPtr->type == KeyPress)) {
149147 int len;
150148 Status status;
151149
150 #if X_HAVE_UTF8_STRING
152151 Tcl_DStringSetLength(dsPtr, TCL_DSTRING_STATIC_SIZE-1);
153152 len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
154153 Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),
155154 NULL, &status);
156155
157 if (status == XBufferOverflow) { /* Expand buffer and try again */
156 if (status == XBufferOverflow) {
157 /*
158 * Expand buffer and try again.
159 */
160
158161 Tcl_DStringSetLength(dsPtr, len);
159162 len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
160163 Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),
165168 len = 0;
166169 }
167170 Tcl_DStringSetLength(dsPtr, len);
168
169 return Tcl_DStringValue(dsPtr);
170 } else {
171 return TkpGetChar(eventPtr, dsPtr);
172 }
173 }
174171 #else /* !X_HAVE_UTF8_STRING */
175 {
176 int len;
177 Tcl_DString buf;
178 Status status;
179
180 /*
181 * Overallocate the dstring to the maximum stack amount.
182 */
183
184 Tcl_DStringInit(&buf);
185 Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
186
187 if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)
188 && (winPtr->inputContext != NULL)
189 && (eventPtr->type == KeyPress)) {
190
172 Tcl_DString buf; /* Holds string in system encoding. */
173
174 /*
175 * Overallocate the dstring to the maximum stack amount.
176 */
177
178 Tcl_DStringInit(&buf);
179 Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
191180 len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
192181 Tcl_DStringValue(&buf), Tcl_DStringLength(&buf), NULL,
193182 &status);
204193 if ((status != XLookupChars) && (status != XLookupBoth)) {
205194 len = 0;
206195 }
207 } else {
208 return TkpGetChar(eventPtr, dsPtr);
209 }
210
211 Tcl_DStringSetLength(&buf, len);
212 Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
213 Tcl_DStringFree(&buf);
214
215 return Tcl_DStringValue(dsPtr);
216 }
217
196 Tcl_DStringSetLength(&buf, len);
197 Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&buf), len, dsPtr);
198 Tcl_DStringFree(&buf);
218199 #endif /* X_HAVE_UTF8_STRING */
219 #else /* !TK_USE_INPUT_METHODS */
220 {
200
201 return Tcl_DStringValue(dsPtr);
202 }
203 #endif /* TK_USE_INPUT_METHODS */
221204 return TkpGetChar(eventPtr, dsPtr);
222205 }
223 #endif
224
225206
226207 /*
227208 * When mapping from a keysym to a keycode, need information about the
235216 KeySym keySym,
236217 XEvent *eventPtr)
237218 {
238 Display *display;
219 Display *display = Tk_Display(tkwin);
239220 int state;
240221 KeyCode keycode;
241
242 display = Tk_Display(tkwin);
243222
244223 if (keySym == NoSymbol) {
245224 keycode = 0;
246225 } else {
247226 keycode = XKeysymToKeycode(display, keySym);
248 }
249 if (keycode != 0) {
250 for (state = 0; state < 4; state++) {
251 if (XKeycodeToKeysym(display, keycode, state) == keySym) {
252 if (state & 1) {
253 eventPtr->xkey.state |= ShiftMask;
227 if (keycode != 0) {
228 for (state = 0; state < 4; state++) {
229 if (XKeycodeToKeysym(display, keycode, state) == keySym) {
230 if (state & 1) {
231 eventPtr->xkey.state |= ShiftMask;
232 }
233 if (state & 2) {
234 TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
235
236 eventPtr->xkey.state |= dispPtr->modeModMask;
237 }
238 break;
254239 }
255 if (state & 2) {
256 TkDisplay *dispPtr;
257
258 dispPtr = ((TkWindow *) tkwin)->dispPtr;
259 eventPtr->xkey.state |= dispPtr->modeModMask;
260 }
261 break;
262240 }
263241 }
264242 }
411389 dispPtr->metaModMask = 0;
412390 dispPtr->altModMask = 0;
413391 codePtr = modMapPtr->modifiermap;
414 max = 8*modMapPtr->max_keypermod;
392 max = 8 * modMapPtr->max_keypermod;
415393 for (i = 0; i < max; i++, codePtr++) {
416394 if (*codePtr == 0) {
417395 continue;
450428
451429 for (j = 0; j < dispPtr->numModKeyCodes; j++) {
452430 if (dispPtr->modKeyCodes[j] == *codePtr) {
431 /*
432 * 'continue' the outer loop.
433 */
434
453435 goto nextModCode;
454436 }
455437 }
456438 if (dispPtr->numModKeyCodes >= arraySize) {
457 KeyCode *new;
439 KeyCode *newCodes;
458440
459441 /*
460442 * Ran out of space in the array; grow it.
461443 */
462444
463445 arraySize *= 2;
464 new = (KeyCode *)
446 newCodes = (KeyCode *)
465447 ckalloc((unsigned) (arraySize * sizeof(KeyCode)));
466 memcpy(new, dispPtr->modKeyCodes,
467 (dispPtr->numModKeyCodes * sizeof(KeyCode)));
448 memcpy(newCodes, dispPtr->modKeyCodes,
449 dispPtr->numModKeyCodes * sizeof(KeyCode));
468450 ckfree((char *) dispPtr->modKeyCodes);
469 dispPtr->modKeyCodes = new;
451 dispPtr->modKeyCodes = newCodes;
470452 }
471453 dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr;
472454 dispPtr->numModKeyCodes++;
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkUnixMenu.c,v 1.20 2008/04/27 22:39:13 dkf Exp $
10 * RCS: @(#) $Id: tkUnixMenu.c,v 1.22 2008/12/09 23:02:17 dkf Exp $
1111 */
1212
1313 #include "default.h"
329329 int *widthPtr, /* The resulting width */
330330 int *heightPtr) /* The resulting height */
331331 {
332 int borderWidth;
333
332334 if ((mePtr->type == CHECK_BUTTON_ENTRY)
333335 || (mePtr->type == RADIO_BUTTON_ENTRY)) {
334336 if (!mePtr->hideMargin && mePtr->indicatorOn) {
353355 }
354356 }
355357 } else {
356 int borderWidth;
357
358 Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
359 menuPtr->borderWidthPtr, &borderWidth);
358 Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
359 &borderWidth);
360360 *heightPtr = 0;
361361 *widthPtr = borderWidth;
362362 }
363363 } else {
364 int borderWidth;
365
366364 Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
367365 &borderWidth);
368 *heightPtr = 0;
369 *widthPtr = borderWidth;
370 }
371 }
372
366 *heightPtr = 0;
367 *widthPtr = borderWidth;
368 }
369 }
373370
374371 /*
375372 *----------------------------------------------------------------------
399396 *heightPtr = fmPtr->linespace;
400397 if (mePtr->type == CASCADE_ENTRY) {
401398 *widthPtr = 2 * CASCADE_ARROW_WIDTH;
402 } else if ((menuPtr->menuType != MENUBAR)
403 && (mePtr->accelPtr != NULL)) {
404 char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
399 } else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) {
400 char *accel = Tcl_GetString(mePtr->accelPtr);
405401
406402 *widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
407403 } else {
509505 &activeBorderWidth);
510506 if ((mePtr->type == CASCADE_ENTRY) && drawArrow) {
511507 points[0].x = x + width - borderWidth - activeBorderWidth
512 - CASCADE_ARROW_WIDTH;
508 - CASCADE_ARROW_WIDTH;
513509 points[0].y = y + (height - CASCADE_ARROW_HEIGHT)/2;
514510 points[1].x = points[0].x;
515511 points[1].y = points[0].y + CASCADE_ARROW_HEIGHT;
520516 (menuPtr->postedCascade == mePtr)
521517 ? TK_RELIEF_SUNKEN : TK_RELIEF_RAISED);
522518 } else if (mePtr->accelPtr != NULL) {
523 char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
519 char *accel = Tcl_GetString(mePtr->accelPtr);
524520 int left = x + mePtr->labelWidth + activeBorderWidth
525 + mePtr->indicatorSpace;
521 + mePtr->indicatorSpace;
526522
527523 if (menuPtr->menuType == MENUBAR) {
528524 left += 5;
702698 haveImage = 1;
703699 } else if (mePtr->bitmapPtr != NULL) {
704700 Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
701
705702 Tk_SizeOfBitmap(menuPtr->display, bitmap, &imageWidth, &imageHeight);
706703 haveImage = 1;
707704 }
708705 if (!haveImage || (mePtr->compound != COMPOUND_NONE)) {
709706 if (mePtr->labelLength > 0) {
710 char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
707 char *label = Tcl_GetString(mePtr->labelPtr);
708
711709 textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
712710 textHeight = fmPtr->linespace;
713711 haveText = 1;
720718
721719 if (haveImage && haveText) {
722720 int fullWidth = (imageWidth > textWidth ? imageWidth : textWidth);
721
723722 switch ((enum compound) mePtr->compound) {
724723 case COMPOUND_TOP:
725724 textXOffset = (fullWidth - textWidth)/2;
802801 int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
803802
804803 if (mePtr->labelLength > 0) {
805 char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
804 char *label = Tcl_GetString(mePtr->labelPtr);
806805
807806 Tk_DrawChars(menuPtr->display, d, gc, tkfont, label,
808807 mePtr->labelLength, leftEdge + textXOffset,
866865 int activeBorderWidth, leftEdge;
867866 const char *label, *start, *end;
868867
869 label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
868 label = Tcl_GetString(mePtr->labelPtr);
870869 start = Tcl_UtfAtIndex(label, mePtr->underline);
871870 end = Tcl_UtfNext(start);
872871
10751074 if (mePtr->entryFlags & ENTRY_HELP_MENU) {
10761075 helpMenuIndex = i;
10771076 } else if (x + mePtr->width + borderWidth > maxWindowWidth) {
1078
10791077 if (i == lastRowBreak) {
10801078 mePtr->y = y;
10811079 mePtr->x = x;
10861084 x = borderWidth;
10871085 for (j = lastRowBreak; j < i; j++) {
10881086 menuPtr->entries[j]->y = y + currentRowHeight
1089 - menuPtr->entries[j]->height;
1087 - menuPtr->entries[j]->height;
10901088 menuPtr->entries[j]->x = x;
10911089 x += menuPtr->entries[j]->width;
10921090 }
12601258
12611259 static void
12621260 SetHelpMenu(
1263 TkMenu *menuPtr) /* The menu we are checking */
1261 TkMenu *menuPtr) /* The menu we are checking */
12641262 {
12651263 TkMenuEntry *cascadeEntryPtr;
12661264
13061304
13071305 void
13081306 TkpDrawMenuEntry(
1309 TkMenuEntry *mePtr, /* The entry to draw */
1310 Drawable d, /* What to draw into */
1311 Tk_Font tkfont, /* Precalculated font for menu */
1307 TkMenuEntry *mePtr, /* The entry to draw */
1308 Drawable d, /* What to draw into */
1309 Tk_Font tkfont, /* Precalculated font for menu */
13121310 const Tk_FontMetrics *menuMetricsPtr,
1313 /* Precalculated metrics for menu */
1314 int x, /* X-coordinate of topleft of entry */
1315 int y, /* Y-coordinate of topleft of entry */
1316 int width, /* Width of the entry rectangle */
1317 int height, /* Height of the current rectangle */
1318 int strictMotif, /* Boolean flag */
1319 int drawArrow) /* Whether or not to draw the cascade
1320 * arrow for cascade items. Only applies
1321 * to Windows. */
1311 /* Precalculated metrics for menu */
1312 int x, /* X-coordinate of topleft of entry */
1313 int y, /* Y-coordinate of topleft of entry */
1314 int width, /* Width of the entry rectangle */
1315 int height, /* Height of the current rectangle */
1316 int strictMotif, /* Boolean flag */
1317 int drawArrow) /* Whether or not to draw the cascade arrow
1318 * for cascade items. Only applies to
1319 * Windows. */
13221320 {
13231321 GC gc, indicatorGC;
13241322 XColor *indicatorColor, *disableColor = NULL;
14721470 haveImage = 1;
14731471 } else if (mePtr->bitmapPtr != NULL) {
14741472 Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
1473
14751474 Tk_SizeOfBitmap(menuPtr->display, bitmap, widthPtr, heightPtr);
14761475 haveImage = 1;
14771476 } else {
14901489
14911490 if (mePtr->labelPtr != NULL) {
14921491 int textWidth;
1493 char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
1492 char *label = Tcl_GetString(mePtr->labelPtr);
1493
14941494 textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
1495
14961495 if ((mePtr->compound != COMPOUND_NONE) && haveImage) {
14971496 switch ((enum compound) mePtr->compound) {
14981497 case COMPOUND_TOP:
16751674 accelWidth = width;
16761675 }
16771676
1678 GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont,
1679 fmPtr, &width, &height);
1677 GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont, fmPtr,
1678 &width, &height);
16801679 if (height > mePtr->height) {
16811680 mePtr->height = height;
16821681 }
16891688
16901689 mePtr->height += 2 * activeBorderWidth + MENU_DIVIDER_HEIGHT;
16911690 }
1692 mePtr->y = y;
1691 mePtr->y = y;
16931692 y += mePtr->height;
16941693 if (y > windowHeight) {
16951694 windowHeight = y;
1010 * See the file "license.terms" for information on usage and redistribution
1111 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkUnixPort.h,v 1.15 2008/08/28 18:13:36 dgp Exp $
13 * RCS: @(#) $Id: tkUnixPort.h,v 1.16 2008/12/17 22:51:25 nijtmans Exp $
1414 */
1515
1616 #ifndef _UNIXPORT
1717 #define _UNIXPORT
1818
1919 #define __UNIX__ 1
20
21 /*
22 * Macro to use instead of "void" for arguments that must have
23 * type "void *" in ANSI C; maps them to type "char *" in
24 * non-ANSI systems. This macro may be used in some of the include
25 * files below, which is why it is defined here.
26 */
27
28 #ifndef VOID
29 # ifdef __STDC__
30 # define VOID void
31 # else
32 # define VOID char
33 # endif
34 #endif
3520
3621 #include <stdio.h>
3722 #include <ctype.h>
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkUnixRFont.c,v 1.25 2008/04/27 22:39:13 dkf Exp $
10 * RCS: @(#) $Id: tkUnixRFont.c,v 1.27 2008/11/22 18:08:51 dkf Exp $
1111 */
1212
1313 #include "tkUnixInt.h"
1717
1818 typedef struct {
1919 XftFont *ftFont;
20 XftFont *ft0Font;
2021 FcPattern *source;
2122 FcCharSet *charset;
23 double angle;
2224 } UnixFtFace;
2325
2426 typedef struct {
6163 static XftFont *
6264 GetFont(
6365 UnixFtFont *fontPtr,
64 FcChar32 ucs4)
66 FcChar32 ucs4,
67 double angle)
6568 {
6669 int i;
6770
6871 if (ucs4) {
6972 for (i = 0; i < fontPtr->nfaces; i++) {
7073 FcCharSet *charset = fontPtr->faces[i].charset;
74
7175 if (charset && FcCharSetHasChar(charset, ucs4)) {
7276 break;
7377 }
7882 } else {
7983 i = 0;
8084 }
81 if (!fontPtr->faces[i].ftFont) {
82 FcPattern *pat = FcFontRenderPrepare(0,
83 fontPtr->pattern, fontPtr->faces[i].source);
84 XftFont *ftFont = XftFontOpenPattern(fontPtr->display, pat);
85
85 if ((angle == 0.0 && !fontPtr->faces[i].ft0Font) || (angle != 0.0 &&
86 (!fontPtr->faces[i].ftFont || fontPtr->faces[i].angle != angle))){
87 FcPattern *pat = FcFontRenderPrepare(0, fontPtr->pattern,
88 fontPtr->faces[i].source);
89 double s = sin(angle*PI/180.0), c = cos(angle*PI/180.0);
90 FcMatrix mat = {c, -s, s, c};
91 XftFont *ftFont;
92
93 if (angle != 0.0) {
94 FcPatternAddMatrix(pat, FC_MATRIX, &mat);
95 }
96 ftFont = XftFontOpenPattern(fontPtr->display, pat);
8697 if (!ftFont) {
8798 /*
88 * The previous call to XftFontOpenPattern() should not fail,
89 * but sometimes does anyway. Usual cause appears to be
90 * a misconfigured fontconfig installation; see [Bug 1090382].
91 * Try a fallback:
99 * The previous call to XftFontOpenPattern() should not fail, but
100 * sometimes does anyway. Usual cause appears to be a
101 * misconfigured fontconfig installation; see [Bug 1090382]. Try a
102 * fallback:
92103 */
104
93105 ftFont = XftFontOpen(fontPtr->display, fontPtr->screen,
94 FC_FAMILY, FcTypeString, "sans",
95 FC_SIZE, FcTypeDouble, 12.0,
96 NULL);
106 FC_FAMILY, FcTypeString, "sans",
107 FC_SIZE, FcTypeDouble, 12.0,
108 FC_MATRIX, FcTypeMatrix, &mat,
109 NULL);
97110 }
98111 if (!ftFont) {
99112 /*
100 * The previous call should definitely not fail.
101 * Impossible to proceed at this point.
113 * The previous call should definitely not fail. Impossible to
114 * proceed at this point.
102115 */
116
103117 Tcl_Panic("Cannot find a usable font.");
104118 }
105119
106 fontPtr->faces[i].ftFont = ftFont;
107 }
108 return fontPtr->faces[i].ftFont;
120 if (angle == 0.0) {
121 fontPtr->faces[i].ft0Font = ftFont;
122 } else {
123 if (fontPtr->faces[i].ftFont) {
124 XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont);
125 }
126 fontPtr->faces[i].ftFont = ftFont;
127 fontPtr->faces[i].angle = angle;
128 }
129 }
130 return (angle==0.0? fontPtr->faces[i].ft0Font : fontPtr->faces[i].ftFont);
109131 }
110132
111133 /*
120142 XftFont *ftFont,
121143 TkFontAttributes *faPtr)
122144 {
123 char *family = "Unknown", **familyPtr = &family;
145 const char *family = "Unknown";
146 const char *const *familyPtr = &family;
124147 int weight, slant, size, pxsize;
125148 double ptsize;
126149
127 (void)XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr);
150 (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr);
128151 if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
129152 &ptsize) == XftResultMatch) {
130 size = (int)ptsize;
153 size = (int) ptsize;
131154 } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0,
132155 &pxsize) == XftResultMatch) {
133156 size = -pxsize;
163186 * Fill in TkFontMetrics from an XftFont.
164187 */
165188
166 static void GetTkFontMetrics(
189 static void
190 GetTkFontMetrics(
167191 XftFont *ftFont,
168192 TkFontMetrics *fmPtr)
169193 {
220244 set = FcFontSort(0, pattern, FcTrue, NULL, &result);
221245 if (!set) {
222246 FcPatternDestroy(pattern);
223 ckfree((char *)fontPtr);
247 ckfree((char *) fontPtr);
224248 return NULL;
225249 }
226250
235259
236260 for (i = 0; i < set->nfont; i++) {
237261 fontPtr->faces[i].ftFont = 0;
262 fontPtr->faces[i].ft0Font = 0;
238263 fontPtr->faces[i].source = set->fonts[i];
239264 if (FcPatternGetCharSet(set->fonts[i], FC_CHARSET, 0,
240265 &charset) == FcResultMatch) {
242267 } else {
243268 fontPtr->faces[i].charset = 0;
244269 }
270 fontPtr->faces[i].angle = 0.0;
245271 }
246272
247273 fontPtr->display = Tk_Display(tkwin);
256282 /*
257283 * Fill in platform-specific fields of TkFont.
258284 */
259 ftFont = GetFont(fontPtr, 0);
285
286 ftFont = GetFont(fontPtr, 0, 0.0);
260287 fontPtr->font.fid = XLoadFont(Tk_Display(tkwin), "fixed");
261288 GetTkFontAttributes(ftFont, &fontPtr->font.fa);
262289 GetTkFontMetrics(ftFont, &fontPtr->font.fm);
270297 {
271298 Display *display = fontPtr->display;
272299 int i;
273 Tk_ErrorHandler handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL,
274 (ClientData) NULL);
300 Tk_ErrorHandler handler =
301 Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
275302
276303 for (i = 0; i < fontPtr->nfaces; i++) {
277304 if (fontPtr->faces[i].ftFont) {
278305 XftFontClose(fontPtr->display, fontPtr->faces[i].ftFont);
279306 }
307 if (fontPtr->faces[i].ft0Font) {
308 XftFontClose(fontPtr->display, fontPtr->faces[i].ft0Font);
309 }
280310 if (fontPtr->faces[i].charset) {
281311 FcCharSetDestroy(fontPtr->faces[i].charset);
282312 }
283313 }
284314 if (fontPtr->faces) {
285 ckfree((char *)fontPtr->faces);
315 ckfree((char *) fontPtr->faces);
286316 }
287317 if (fontPtr->pattern) {
288318 FcPatternDestroy(fontPtr->pattern);
430460 resultPtr = Tcl_NewListObj(0, NULL);
431461
432462 list = XftListFonts(Tk_Display(tkwin), Tk_ScreenNumber(tkwin),
433 (char*)0, /* pattern elements */
434 XFT_FAMILY, (char*)0); /* fields */
463 (char *) 0, /* pattern elements */
464 XFT_FAMILY, (char*) 0); /* fields */
435465 for (i = 0; i < list->nfont; i++) {
436466 char *family, **familyPtr = &family;
467
437468 if (XftPatternGetString(list->fonts[i], XFT_FAMILY, 0, familyPtr)
438 == XftResultMatch)
439 {
469 == XftResultMatch) {
440470 Tcl_Obj *strPtr = Tcl_NewStringObj(family, -1);
471
441472 Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
442473 }
443474 }
467498 Tcl_Obj *objv[3], *listPtr, *resultPtr;
468499 UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
469500 FcPattern *pattern;
470 char *family = "Unknown", **familyPtr = &family;
471 char *foundry = "Unknown", **foundryPtr = &foundry;
472 char *encoding = "Unknown", **encodingPtr = &encoding;
501 const char *family = "Unknown";
502 const char *const *familyPtr = &family;
503 const char *foundry = "Unknown";
504 const char *const *foundryPtr = &foundry;
505 const char *encoding = "Unknown";
506 const char *const *encodingPtr = &encoding;
473507 int i;
474508
475509 resultPtr = Tcl_NewListObj(0, NULL);
512546 /* Structure describing the logical font */
513547 FcChar32 ucs4 = (FcChar32) c;
514548 /* UCS-4 character to map */
515 XftFont *ftFont = GetFont(fontPtr, ucs4);
549 XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0);
516550 /* Actual font used to render the character */
517551
518552 GetTkFontAttributes(ftFont, faPtr);
561595 Tcl_UniChar unichar;
562596
563597 clen = Tcl_UtfToUniChar(source, &unichar);
564 c = (FcChar32)unichar;
598 c = (FcChar32) unichar;
565599
566600 if (clen <= 0) {
567601 /*
587621 #if DEBUG_FONTSEL
588622 string[len++] = (char) c;
589623 #endif /* DEBUG_FONTSEL */
590 ftFont = GetFont(fontPtr, c);
624 ftFont = GetFont(fontPtr, c, 0.0);
591625
592626 XftTextExtents32(fontPtr->display, ftFont, &c, 1, &extents);
593627
669703 DefaultVisual(display, fontPtr->screen),
670704 DefaultColormap(display, fontPtr->screen));
671705 } else {
672 Tk_ErrorHandler handler = Tk_CreateErrorHandler(display, -1, -1, -1,
673 NULL, (ClientData) NULL);
706 Tk_ErrorHandler handler =
707 Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
674708
675709 XftDrawChange(fontPtr->ftDraw, drawable);
676710 Tk_DeleteErrorHandler(handler);
702736 source += clen;
703737 numBytes -= clen;
704738
705 ftFont = GetFont(fontPtr, c);
739 ftFont = GetFont(fontPtr, c, 0.0);
706740 if (ftFont) {
707741 specs[nspec].font = ftFont;
708742 specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c);
724758 XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color, specs, nspec);
725759 }
726760 }
761
762 void
763 TkpDrawAngledChars(
764 Display *display, /* Display on which to draw. */
765 Drawable drawable, /* Window or pixmap in which to draw. */
766 GC gc, /* Graphics context for drawing characters. */
767 Tk_Font tkfont, /* Font in which characters will be drawn;
768 * must be the same as font used in GC. */
769 const char *source, /* UTF-8 string to be displayed. Need not be
770 * '\0' terminated. All Tk meta-characters
771 * (tabs, control characters, and newlines)
772 * should be stripped out of the string that
773 * is passed to this function. If they are not
774 * stripped out, they will be displayed as
775 * regular printing characters. */
776 int numBytes, /* Number of bytes in string. */
777 double x, double y, /* Coordinates at which to place origin of
778 * string when drawing. */
779 double angle) /* What angle to put text at, in degrees. */
780 {
781 const int maxCoord = 0x7FFF;/* Xft coordinates are 16 bit values */
782 const int minCoord = -1000; /* Should be good enough... */
783 UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
784 XGCValues values;
785 XColor xcolor;
786 #ifdef XFT_HAS_FIXED_ROTATED_PLACEMENT
787 int clen, nglyph;
788 FT_UInt glyphs[NUM_SPEC];
789 XGlyphInfo metrics;
790 XftFont *currentFtFont;
791 int originX, originY;
792
793 if (fontPtr->ftDraw == 0) {
794 #if DEBUG_FONTSEL
795 printf("Switch to drawable 0x%x\n", drawable);
796 #endif /* DEBUG_FONTSEL */
797 fontPtr->ftDraw = XftDrawCreate(display, drawable,
798 DefaultVisual(display, fontPtr->screen),
799 DefaultColormap(display, fontPtr->screen));
800 } else {
801 Tk_ErrorHandler handler =
802 Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
803
804 XftDrawChange(fontPtr->ftDraw, drawable);
805 Tk_DeleteErrorHandler(handler);
806 }
807
808 XGetGCValues(display, gc, GCForeground, &values);
809 if (values.foreground != fontPtr->color.pixel) {
810 xcolor.pixel = values.foreground;
811 XQueryColor(display, DefaultColormap(display, fontPtr->screen),
812 &xcolor);
813 fontPtr->color.color.red = xcolor.red;
814 fontPtr->color.color.green = xcolor.green;
815 fontPtr->color.color.blue = xcolor.blue;
816 fontPtr->color.color.alpha = 0xffff;
817 fontPtr->color.pixel = values.foreground;
818 }
819
820 nglyph = 0;
821 currentFtFont = NULL;
822 originX = originY = 0; /* lint */
823
824 while (numBytes > 0 && x <= maxCoord && x >= minCoord && y <= maxCoord
825 && y >= minCoord) {
826 XftFont *ftFont;
827 FcChar32 c;
828
829 clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
830 if (clen <= 0) {
831 /*
832 * This should not happen, but it can.
833 */
834
835 return;
836 }
837 source += clen;
838 numBytes -= clen;
839
840 ftFont = GetFont(fontPtr, c, angle);
841 if (!ftFont) {
842 continue;
843 }
844
845 if (ftFont != currentFtFont || nglyph == NUM_SPEC) {
846 if (nglyph) {
847 /*
848 * We pass multiple glyphs at once to enable the code to
849 * perform better rendering of sub-pixel inter-glyph spacing.
850 * If only the current Xft implementation could make use of
851 * this information... but we'll be ready when it does!
852 */
853
854 XftDrawGlyphs(fontPtr->ftDraw, &fontPtr->color, currentFtFont,
855 originX, originY, glyphs, nglyph);
856 }
857 originX = (int) floor(x + 0.5);
858 originY = (int) floor(y + 0.5);
859 if (nglyph) {
860 XftGlyphExtents(fontPtr->display, currentFtFont, glyphs,
861 nglyph, &metrics);
862 nglyph = 0;
863 x += metrics.xOff;
864 y += metrics.yOff;
865 }
866 currentFtFont = ftFont;
867 }
868 glyphs[nglyph++] = XftCharIndex(fontPtr->display, ftFont, c);
869 }
870 if (nglyph) {
871 XftDrawGlyphs(fontPtr->ftDraw, &fontPtr->color, currentFtFont,
872 originX, originY, glyphs, nglyph);
873 }
874 #else /* !XFT_HAS_FIXED_ROTATED_PLACEMENT */
875 int clen, nspec;
876 XftGlyphFontSpec specs[NUM_SPEC];
877 XGlyphInfo metrics;
878 double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
879
880 if (fontPtr->ftDraw == 0) {
881 #if DEBUG_FONTSEL
882 printf("Switch to drawable 0x%x\n", drawable);
883 #endif /* DEBUG_FONTSEL */
884 fontPtr->ftDraw = XftDrawCreate(display, drawable,
885 DefaultVisual(display, fontPtr->screen),
886 DefaultColormap(display, fontPtr->screen));
887 } else {
888 Tk_ErrorHandler handler =
889 Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
890
891 XftDrawChange(fontPtr->ftDraw, drawable);
892 Tk_DeleteErrorHandler(handler);
893 }
894 XGetGCValues(display, gc, GCForeground, &values);
895 if (values.foreground != fontPtr->color.pixel) {
896 xcolor.pixel = values.foreground;
897 XQueryColor(display, DefaultColormap(display, fontPtr->screen),
898 &xcolor);
899 fontPtr->color.color.red = xcolor.red;
900 fontPtr->color.color.green = xcolor.green;
901 fontPtr->color.color.blue = xcolor.blue;
902 fontPtr->color.color.alpha = 0xffff;
903 fontPtr->color.pixel = values.foreground;
904 }
905 nspec = 0;
906 while (numBytes > 0 && x <= maxCoord && x >= minCoord
907 && y <= maxCoord && y >= minCoord) {
908 XftFont *ftFont, *ft0Font;
909 FcChar32 c;
910
911 clen = FcUtf8ToUcs4((FcChar8 *) source, &c, numBytes);
912 if (clen <= 0) {
913 /*
914 * This should not happen, but it can.
915 */
916
917 return;
918 }
919 source += clen;
920 numBytes -= clen;
921
922 ftFont = GetFont(fontPtr, c, angle);
923 ft0Font = GetFont(fontPtr, c, 0.0);
924 if (ftFont && ft0Font) {
925 specs[nspec].font = ftFont;
926 specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c);
927 specs[nspec].x = (int) floor(x + 0.5);
928 specs[nspec].y = (int) floor(y + 0.5);
929 XftGlyphExtents(fontPtr->display, ft0Font, &specs[nspec].glyph, 1,
930 &metrics);
931 x += metrics.xOff*cosA + metrics.yOff*sinA;
932 y += metrics.yOff*cosA - metrics.xOff*sinA;
933 nspec++;
934 if (nspec == NUM_SPEC) {
935 XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color,
936 specs, nspec);
937 nspec = 0;
938 }
939 }
940 }
941 if (nspec) {
942 XftDrawGlyphFontSpec(fontPtr->ftDraw, &fontPtr->color, specs, nspec);
943 }
944 #endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */
945 }
946
947 /*
948 * Local Variables:
949 * c-basic-offset: 4
950 * fill-column: 78
951 * End:
952 */
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkUnixScale.c,v 1.13 2007/12/13 15:28:51 dgp Exp $
11 * RCS: @(#) $Id: tkUnixScale.c,v 1.14 2008/12/09 21:22:56 dgp Exp $
1212 */
1313
1414 #include "tkInt.h"
556556 (char *) NULL);
557557 if (result != TCL_OK) {
558558 Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
559 Tcl_BackgroundError(interp);
559 Tcl_BackgroundException(interp, result);
560560 }
561561 Tcl_Release((ClientData) interp);
562562 }
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkUnixScrlbr.c,v 1.6 2007/12/13 15:28:51 dgp Exp $
11 * RCS: @(#) $Id: tkUnixScrlbr.c,v 1.7 2008/12/09 23:21:48 dkf Exp $
1212 */
1313
1414 #include "tkInt.h"
6161 TkpCreateScrollbar(
6262 Tk_Window tkwin)
6363 {
64 UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar));
64 UnixScrollbar *scrollPtr = (UnixScrollbar *)
65 ckalloc(sizeof(UnixScrollbar));
66
6567 scrollPtr->troughGC = None;
6668 scrollPtr->copyGC = None;
6769
405407 unixScrollPtr->troughGC = new;
406408 if (unixScrollPtr->copyGC == None) {
407409 gcValues.graphics_exposures = False;
408 unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin, GCGraphicsExposures,
409 &gcValues);
410 unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin,
411 GCGraphicsExposures, &gcValues);
410412 }
411413 }
412414
435437 int x, int y) /* Coordinates within scrollPtr's window. */
436438 {
437439 int length, width, tmp;
440 register const int inset = scrollPtr->inset;
438441
439442 if (scrollPtr->vertical) {
440443 length = Tk_Height(scrollPtr->tkwin);
447450 width = Tk_Height(scrollPtr->tkwin);
448451 }
449452
450 if ((x < scrollPtr->inset) || (x >= (width - scrollPtr->inset))
451 || (y < scrollPtr->inset) || (y >= (length - scrollPtr->inset))) {
453 if (x<inset || x>=width-inset || y<inset || y>=length-inset) {
452454 return OUTSIDE;
453455 }
454456
457459 * TkpDisplayScrollbar. Be sure to keep the two consistent.
458460 */
459461
460 if (y < (scrollPtr->inset + scrollPtr->arrowLength)) {
462 if (y < inset + scrollPtr->arrowLength) {
461463 return TOP_ARROW;
462464 }
463465 if (y < scrollPtr->sliderFirst) {
466468 if (y < scrollPtr->sliderLast) {
467469 return SLIDER;
468470 }
469 if (y >= (length - (scrollPtr->arrowLength + scrollPtr->inset))) {
471 if (y >= length - (scrollPtr->arrowLength + inset)) {
470472 return BOTTOM_ARROW;
471473 }
472474 return BOTTOM_GAP;
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkUnixSelect.c,v 1.21 2007/05/03 22:16:00 dkf Exp $
10 * RCS: @(#) $Id: tkUnixSelect.c,v 1.22 2008/11/08 18:44:40 dkf Exp $
1111 */
1212
1313 #include "tkInt.h"
325325 length = strlen(incrPtr->converts[i].buffer);
326326 strcpy((char *)buffer, incrPtr->converts[i].buffer);
327327
328 numItems = (*selPtr->proc)(selPtr->clientData,
328 numItems = selPtr->proc(selPtr->clientData,
329329 incrPtr->converts[i].offset,
330330 ((char *) buffer) + length,
331331 TK_SEL_BYTES_AT_ONCE - length);
593593 return;
594594 }
595595 interp = retrPtr->interp;
596 Tcl_Preserve((ClientData) interp);
596 Tcl_Preserve(interp);
597597
598598 /*
599599 * Convert the X selection data into UTF before passing it to the
616616 Tcl_FreeEncoding(encoding);
617617 }
618618
619 retrPtr->result = (*retrPtr->proc)(retrPtr->clientData,
620 interp, Tcl_DStringValue(&ds));
619 retrPtr->result = retrPtr->proc(retrPtr->clientData, interp,
620 Tcl_DStringValue(&ds));
621621 Tcl_DStringFree(&ds);
622 Tcl_Release((ClientData) interp);
622 Tcl_Release(interp);
623623 } else if (type == dispPtr->utf8Atom) {
624624 /*
625625 * The X selection data is in UTF-8 format already. We can't
645645 strcpy(propData, propInfo);
646646 propData[numItems] = '\0';
647647 }
648 retrPtr->result = (*retrPtr->proc)(retrPtr->clientData,
648 retrPtr->result = retrPtr->proc(retrPtr->clientData,
649649 retrPtr->interp, propData);
650650 if (propData != propInfo) {
651651 ckfree((char *) propData);
685685 SelCvtFromX((long *) propInfo, (int) numItems, type,
686686 (Tk_Window) winPtr, &ds);
687687 interp = retrPtr->interp;
688 Tcl_Preserve((ClientData) interp);
689 retrPtr->result = (*retrPtr->proc)(retrPtr->clientData,
688 Tcl_Preserve(interp);
689 retrPtr->result = retrPtr->proc(retrPtr->clientData,
690690 interp, Tcl_DStringValue(&ds));
691 Tcl_Release((ClientData) interp);
691 Tcl_Release(interp);
692692 Tcl_DStringFree(&ds);
693693 }
694694 XFree(propInfo);
917917 ip.nextPtr = TkSelGetInProgress();
918918 TkSelSetInProgress(&ip);
919919 type = selPtr->format;
920 numItems = (*selPtr->proc)(selPtr->clientData, 0,
921 (char *) buffer, TK_SEL_BYTES_AT_ONCE);
920 numItems = selPtr->proc(selPtr->clientData, 0, (char *) buffer,
921 TK_SEL_BYTES_AT_ONCE);
922922 TkSelSetInProgress(ip.nextPtr);
923923 if ((ip.selPtr == NULL) || (numItems < 0)) {
924924 incr.multAtoms[2*i + 1] = None;
12261226 }
12271227 Tcl_DStringSetLength(dstPtr, soFar);
12281228
1229 result = (*retrPtr->proc)(retrPtr->clientData, interp,
1229 result = retrPtr->proc(retrPtr->clientData, interp,
12301230 Tcl_DStringValue(dstPtr));
12311231 Tcl_Release((ClientData) interp);
12321232
12641264 SelCvtFromX((long *) propInfo, (int) numItems, type,
12651265 (Tk_Window) retrPtr->winPtr, &ds);
12661266 interp = retrPtr->interp;
1267 Tcl_Preserve((ClientData) interp);
1268 result = (*retrPtr->proc)(retrPtr->clientData, interp,
1267 Tcl_Preserve(interp);
1268 result = retrPtr->proc(retrPtr->clientData, interp,
12691269 Tcl_DStringValue(&ds));
1270 Tcl_Release((ClientData) interp);
1270 Tcl_Release(interp);
12711271 Tcl_DStringFree(&ds);
12721272 if (result != TCL_OK) {
12731273 retrPtr->result = result;
13131313 TkSelSetInProgress(&ip);
13141314
13151315 do {
1316 chunkSize = (*selPtr->proc)(selPtr->clientData, size, (char *) buffer,
1316 chunkSize = selPtr->proc(selPtr->clientData, size, (char *) buffer,
13171317 TK_SEL_BYTES_AT_ONCE);
13181318 if (ip.selPtr == NULL) {
13191319 size = 0;
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkUnixSend.c,v 1.22 2008/07/23 23:24:46 nijtmans Exp $
13 * RCS: @(#) $Id: tkUnixSend.c,v 1.24 2008/11/18 23:49:43 nijtmans Exp $
1414 */
1515
1616 #include "tkUnixInt.h"
225225 static void UpdateCommWindow(TkDisplay *dispPtr);
226226 static int ValidateName(TkDisplay *dispPtr, const char *name,
227227 Window commWindow, int oldOK);
228
228
229229 /*
230230 *----------------------------------------------------------------------
231231 *
324324 }
325325 return regPtr;
326326 }
327
327
328328 /*
329329 *----------------------------------------------------------------------
330330 *
377377 }
378378 return None;
379379 }
380
380
381381 /*
382382 *----------------------------------------------------------------------
383383 *
441441 }
442442 }
443443 }
444
444
445445 /*
446446 *----------------------------------------------------------------------
447447 *
491491 regPtr->property = newProp;
492492 regPtr->allocedByX = 0;
493493 }
494
494
495495 /*
496496 *----------------------------------------------------------------------
497497 *
551551 }
552552 ckfree((char *) regPtr);
553553 }
554
554
555555 /*
556556 *----------------------------------------------------------------------
557557 *
646646 }
647647 return result;
648648 }
649
649
650650 /*
651651 *----------------------------------------------------------------------
652652 *
689689 return secure;
690690 #endif /* TK_NO_SECURITY */
691691 }
692
692
693693 /*
694694 *--------------------------------------------------------------
695695 *
848848
849849 return riPtr->name;
850850 }
851
851
852852 /*
853853 *--------------------------------------------------------------
854854 *
10861086
10871087 if (!ValidateName(pending.dispPtr, pending.target,
10881088 pending.commWindow, 0)) {
1089 char *msg;
1089 const char *msg;
10901090
10911091 if (ValidateName(pending.dispPtr, pending.target,
10921092 pending.commWindow, 1)) {
11331133 Tcl_SetObjErrorCode(interp, errorObjPtr);
11341134 ckfree(pending.errorCode);
11351135 }
1136 Tcl_SetResult(interp, pending.result, TCL_DYNAMIC);
1136 Tcl_SetResult(interp, pending.result, TCL_VOLATILE);
1137 ckfree(pending.result);
11371138 return pending.code;
11381139 }
1139
1140
11401141 /*
11411142 *----------------------------------------------------------------------
11421143 *
12241225 RegClose(regPtr);
12251226 return TCL_OK;
12261227 }
1227
1228
12281229 /*
12291230 *--------------------------------------------------------------
12301231 *
12541255 dispPtr->commTkwin = NULL;
12551256 }
12561257 }
1257
1258
12581259 /*
12591260 *--------------------------------------------------------------
12601261 *
13111312
13121313 return TCL_OK;
13131314 }
1314
1315
13151316 /*
13161317 *--------------------------------------------------------------
13171318 *
13391340 {
13401341 TkDisplay *dispPtr = clientData;
13411342 char *propInfo, **propInfoPtr = &propInfo;
1342 register char *p;
1343 const char *p;
13431344 int result, actualFormat;
13441345 unsigned long numItems, bytesAfter;
13451346 Atom actualType;
13941395
13951396 if ((*p == 'c') && (p[1] == 0)) {
13961397 Window commWindow;
1397 char *interpName, *script, *serial, *end;
1398 const char *interpName, *script, *serial;
1399 char *end;
13981400 Tcl_DString reply;
13991401 RegisteredInterp *riPtr;
14001402
15491551 }
15501552 } else if ((*p == 'r') && (p[1] == 0)) {
15511553 int serial, code, gotSerial;
1552 char *errorInfo, *errorCode, *resultString;
1554 const char *errorInfo, *errorCode, *resultString;
15531555 PendingCommand *pcPtr;
15541556
15551557 /*
16481650 }
16491651 XFree(propInfo);
16501652 }
1651
1653
16521654 /*
16531655 *--------------------------------------------------------------
16541656 *
17271729 }
17281730 return 0;
17291731 }
1730
1732
17311733 /*
17321734 *--------------------------------------------------------------
17331735 *
17761778 UpdateCommWindow(riPtr->dispPtr);
17771779 Tcl_EventuallyFree(riPtr, TCL_DYNAMIC);
17781780 }
1779
1781
17801782 /*
17811783 *----------------------------------------------------------------------
17821784 *
18161818 }
18171819 return TK_DEFER_EVENT;
18181820 }
1819
1821
18201822 /*
18211823 *----------------------------------------------------------------------
18221824 *
18561858 Tcl_DStringLength(&names));
18571859 Tcl_DStringFree(&names);
18581860 }
1859
1861
18601862 /*
18611863 *----------------------------------------------------------------------
18621864 *
19641966 }
19651967 return TCL_OK;
19661968 }
1967
1969
19681970 /*
19691971 * Local Variables:
19701972 * mode: c
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkUnixWm.c,v 1.62 2008/10/08 15:39:13 dgp Exp $
14 * RCS: @(#) $Id: tkUnixWm.c,v 1.69 2008/12/10 04:13:01 das Exp $
1515 */
1616
1717 #include "tkUnixInt.h"
4343 * Data for [wm attributes] command:
4444 */
4545 typedef struct {
46 double alpha; /* Transparency; 0.0=transparent, 1.0=opaque */
47 int topmost; /* Flag: true=>stay-on-top */
48 int zoomed; /* Flag: true=>maximized */
49 int fullscreen; /* Flag: true=>fullscreen */
46 double alpha; /* Transparency; 0.0=transparent, 1.0=opaque */
47 int topmost; /* Flag: true=>stay-on-top */
48 int zoomed; /* Flag: true=>maximized */
49 int fullscreen; /* Flag: true=>fullscreen */
5050 } WmAttributes;
5151
5252 typedef enum {
5454 _WMATT_LAST_ATTRIBUTE
5555 } WmAttribute;
5656
57 static const char *WmAttributeNames[] = {
57 static const char *const WmAttributeNames[] = {
5858 "-alpha", "-topmost", "-zoomed", "-fullscreen",
5959 NULL
6060 };
12431243 Tcl_Obj *value) /* New value */
12441244 {
12451245 WmInfo *wmPtr = winPtr->wmInfoPtr;
1246
12461247 switch (attribute) {
12471248 case WMATT_ALPHA: {
12481249 unsigned long opacity; /* 0=transparent, 0xFFFFFFFF=opaque */
12721273 break;
12731274 }
12741275 case WMATT_TOPMOST:
1275 if (TCL_OK != Tcl_GetBooleanFromObj(interp, value,
1276 &wmPtr->reqState.topmost)) {
1276 if (Tcl_GetBooleanFromObj(interp, value,
1277 &wmPtr->reqState.topmost) != TCL_OK) {
12771278 return TCL_ERROR;
12781279 }
1279 SetNetWmState(winPtr, "_NET_WM_STATE_ABOVE",
1280 wmPtr->reqState.topmost);
1280 SetNetWmState(winPtr, "_NET_WM_STATE_ABOVE", wmPtr->reqState.topmost);
12811281 break;
12821282 case WMATT_ZOOMED:
1283 if (TCL_OK != Tcl_GetBooleanFromObj(interp, value,
1284 &wmPtr->reqState.zoomed)) {
1283 if (Tcl_GetBooleanFromObj(interp, value,
1284 &wmPtr->reqState.zoomed) != TCL_OK) {
12851285 return TCL_ERROR;
12861286 }
12871287 SetNetWmState(winPtr, "_NET_WM_STATE_MAXIMIZED_VERT",
12901290 wmPtr->reqState.zoomed);
12911291 break;
12921292 case WMATT_FULLSCREEN:
1293 if (TCL_OK != Tcl_GetBooleanFromObj(interp, value,
1294 &wmPtr->reqState.fullscreen)) {
1293 if (Tcl_GetBooleanFromObj(interp, value,
1294 &wmPtr->reqState.fullscreen) != TCL_OK) {
12951295 return TCL_ERROR;
12961296 }
12971297 SetNetWmState(winPtr, "_NET_WM_STATE_FULLSCREEN",
13861386 return TCL_OK;
13871387 } else if (objc == 4) { /* wm attributes $win -attribute */
13881388 if (Tcl_GetIndexFromObj(interp, objv[3], WmAttributeNames,
1389 "attribute", 0, &attribute) != TCL_OK) {
1389 "attribute", 0, &attribute) != TCL_OK) {
13901390 return TCL_ERROR;
13911391 }
13921392 Tcl_SetObjResult(interp, WmGetAttribute(winPtr, attribute));
16311631 }
16321632 if (objc == 3) {
16331633 if (wmPtr->cmdArgv != NULL) {
1634 Tcl_SetResult(interp,
1635 Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv),
1636 TCL_DYNAMIC);
1634 argv3 = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
1635 Tcl_SetResult(interp, argv3, TCL_VOLATILE);
1636 ckfree(argv3);
16371637 }
16381638 return TCL_OK;
16391639 }
17351735 Tcl_Obj *const objv[]) /* Argument objects. */
17361736 {
17371737 register WmInfo *wmPtr = winPtr->wmInfoPtr;
1738 static const char *optionStrings[] = {
1738 static const char *const optionStrings[] = {
17391739 "active", "passive", NULL };
17401740 enum options {
17411741 OPT_ACTIVE, OPT_PASSIVE };
25512551 }
25522552 if (objc == 3) {
25532553 if (wmPtr->icon != NULL) {
2554 Tcl_SetResult(interp, Tk_PathName(wmPtr->icon), TCL_STATIC);
2554 Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
25552555 }
25562556 return TCL_OK;
25572557 }
26592659 register WmInfo *wmPtr = winPtr->wmInfoPtr;
26602660
26612661 if (!Tk_IsTopLevel(frameWin)) {
2662 if (!Tk_IsManageable(frameWin)) {
2663 Tcl_AppendResult(interp, "window \"",
2664 Tk_PathName(frameWin), "\" is not manageable: must be "
2665 "a frame, labelframe or toplevel", NULL);
2666 return TCL_ERROR;
2667 }
26622668 TkFocusSplit(winPtr);
26632669 Tk_UnmapWindow(frameWin);
26642670 winPtr->flags |= TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED;
28712877 Tcl_Obj *const objv[]) /* Argument objects. */
28722878 {
28732879 register WmInfo *wmPtr = winPtr->wmInfoPtr;
2874 static const char *optionStrings[] = {
2880 static const char *const optionStrings[] = {
28752881 "program", "user", NULL };
28762882 enum options {
28772883 OPT_PROGRAM, OPT_USER };
31003106 Tcl_Obj *const objv[]) /* Argument objects. */
31013107 {
31023108 register WmInfo *wmPtr = winPtr->wmInfoPtr;
3103 static const char *optionStrings[] = {
3109 static const char *const optionStrings[] = {
31043110 "program", "user", NULL };
31053111 enum options {
31063112 OPT_PROGRAM, OPT_USER };
31653171 Tcl_Obj *const objv[]) /* Argument objects. */
31663172 {
31673173 TkWindow **windows, **window_ptr;
3168 static const char *optionStrings[] = {
3174 static const char *const optionStrings[] = {
31693175 "isabove", "isbelow", NULL };
31703176 enum options {
31713177 OPT_ISABOVE, OPT_ISBELOW };
32853291 Tcl_Obj *const objv[]) /* Argument objects. */
32863292 {
32873293 register WmInfo *wmPtr = winPtr->wmInfoPtr;
3288 static const char *optionStrings[] = {
3294 static const char *const optionStrings[] = {
32893295 "normal", "iconic", "withdrawn", NULL };
32903296 enum options {
32913297 OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN };
34413447 }
34423448 if (objc == 3) {
34433449 if (masterPtr != NULL) {
3444 Tcl_SetResult(interp, Tk_PathName(masterPtr), TCL_STATIC);
3450 Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) masterPtr));
34453451 }
34463452 return TCL_OK;
34473453 }
45894595 * Reconfigure the wrapper if it isn't already configured correctly. A few
45904596 * tricky points:
45914597 *
4592 * 1. If the window is embeddedand the container is also in this process,
4598 * 1. If the window is embedded and the container is also in this process,
45934599 * don't actually reconfigure the window; just pass the desired size on
45944600 * to the container. Also, zero out any position information, since
45954601 * embedded windows are not allowed to move.
60796085 Tcl_Preserve((ClientData) interp);
60806086 result = Tcl_GlobalEval(interp, protPtr->command);
60816087 if (result != TCL_OK) {
6082 Tcl_AddErrorInfo(interp, "\n (command for \"");
6083 Tcl_AddErrorInfo(interp, protocolName);
6084 Tcl_AddErrorInfo(interp,
6085 "\" window manager protocol)");
6086 Tcl_BackgroundError(interp);
6088 Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
6089 "\n (command for \"%s\" window manager protocol)",
6090 protocolName));
6091 Tcl_BackgroundException(interp, result);
60876092 }
60886093 Tcl_Release((ClientData) interp);
60896094 Tcl_Release((ClientData) protPtr);
71427147 */
71437148
71447149 static void
7145 RemapWindows(winPtr, parentPtr)
7146 TkWindow *winPtr;
7147 TkWindow *parentPtr;
7150 RemapWindows(
7151 TkWindow *winPtr,
7152 TkWindow *parentPtr)
71487153 {
71497154 XWindowAttributes win_attr;
71507155
33 # "autoconf" program (constructs like "@foo@" will get replaced in the
44 # actual Makefile.
55 #
6 # RCS: @(#) $Id: Makefile.in,v 1.80 2008/08/25 11:44:04 dkf Exp $
6 # RCS: @(#) $Id: Makefile.in,v 1.82 2008/12/05 10:48:52 dkf Exp $
77
88 TCLVERSION = @TCL_VERSION@
99 TCLPATCHL = @TCL_PATCH_LEVEL@
281281 tkAtom.$(OBJEXT) \
282282 tkBind.$(OBJEXT) \
283283 tkBitmap.$(OBJEXT) \
284 tkBusy.$(OBJEXT) \
284285 tkButton.$(OBJEXT) \
285286 tkCanvArc.$(OBJEXT) \
286287 tkCanvBmap.$(OBJEXT) \
515516 $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/X11; \
516517 done;
517518 @echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
518 @for i in $(ROOT_DIR)/library/*.tcl $(GENERIC_DIR)/prolog.ps \
519 $(ROOT_DIR)/library/tclIndex $(UNIX_DIR)/tkAppInit.c; \
519 @for i in $(ROOT_DIR)/library/*.tcl $(ROOT_DIR)/library/tclIndex \
520 $(UNIX_DIR)/tkAppInit.c; \
520521 do \
521522 $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
522523 done;
13081308 TK_VERSION=8.6
13091309 TK_MAJOR_VERSION=8
13101310 TK_MINOR_VERSION=6
1311 TK_PATCH_LEVEL="a3"
1311 TK_PATCH_LEVEL="b1"
13121312 VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
13131313
13141314 #------------------------------------------------------------------------
22 # generate the file "configure", which is run during Tk installation
33 # to configure the system for the local environment.
44 #
5 # RCS: @(#) $Id: configure.in,v 1.82 2008/08/28 16:29:38 dgp Exp $
5 # RCS: @(#) $Id: configure.in,v 1.84 2008/12/19 14:32:25 dgp Exp $
66
77 AC_INIT(../generic/tk.h)
88 AC_PREREQ(2.59)
1515 TK_VERSION=8.6
1616 TK_MAJOR_VERSION=8
1717 TK_MINOR_VERSION=6
18 TK_PATCH_LEVEL="a3"
18 TK_PATCH_LEVEL="b1"
1919 VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
2020
2121 #------------------------------------------------------------------------
1212 # Copyright (c) 1995-1997 Sun Microsystems, Inc.
1313 # Copyright (c) 1998-2000 Ajuba Solutions.
1414 #
15 # RCS: @(#) $Id: makefile.bc,v 1.16 2008/08/25 11:44:04 dkf Exp $
15 # RCS: @(#) $Id: makefile.bc,v 1.17 2008/10/18 14:22:22 dkf Exp $
1616
1717 # Does not depend on the presence of any environment variables in
1818 # order to compile tcl; all needed information is derived from
162162 $(TMPDIR)\tkAtom.obj \
163163 $(TMPDIR)\tkBind.obj \
164164 $(TMPDIR)\tkBitmap.obj \
165 $(TMPDIR)\tkBusy.obj \
165166 $(TMPDIR)\tkButton.obj \
166167 $(TMPDIR)\tkCanvArc.obj \
167168 $(TMPDIR)\tkCanvBmap.obj \
1212 # Copyright (c) 2003-2008 Pat Thoyts.
1313 #
1414 #------------------------------------------------------------------------------
15 # RCS: @(#) $Id: makefile.vc,v 1.124 2008/08/25 11:44:04 dkf Exp $
15 # RCS: @(#) $Id: makefile.vc,v 1.126 2008/10/19 21:22:36 patthoyts Exp $
1616 #------------------------------------------------------------------------------
1717
1818 # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR)
289289 $(TMP_DIR)\tkAtom.obj \
290290 $(TMP_DIR)\tkBind.obj \
291291 $(TMP_DIR)\tkBitmap.obj \
292 $(TMP_DIR)\tkBusy.obj \
292293 $(TMP_DIR)\tkButton.obj \
293294 $(TMP_DIR)\tkCanvArc.obj \
294295 $(TMP_DIR)\tkCanvBmap.obj \
423424 -DTTK_SQUARE_WIDGET=1 \
424425 !endif
425426
426 TK_DEFINES =-DBUILD_ttk $(OPTDEFINES) $(CONFIG_DEFS)
427 TK_DEFINES =-DBUILD_ttk $(OPTDEFINES) $(CONFIG_DEFS) -Dinline=__inline
427428
428429 #---------------------------------------------------------------------
429430 # Compile flags
469470 TK_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES)
470471 CON_CFLAGS = $(cdebug) $(cflags) $(crt) -DCONSOLE
471472 WISH_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES)
472 STUB_CFLAGS = $(cflags) $(cdebug) $(TK_DEFINES)
473 ### Stubs files should not be compiled with -GL
474 STUB_CFLAGS = $(cflags) $(cdebug:-GL=) $(TK_DEFINES)
473475
474476 !if !$(STATIC_BUILD)
475477 TK_CFLAGS = $(TK_CFLAGS) -DUSE_TCL_STUBS
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
1212 * ----------------------------------------------------------------------------
13 * RCS: @(#) $Id: nmakehlp.c,v 1.11 2007/12/14 02:19:43 patthoyts Exp $
13 * RCS: @(#) $Id: nmakehlp.c,v 1.12 2008/11/08 18:44:40 dkf Exp $
1414 * ----------------------------------------------------------------------------
1515 */
1616
591591
592592 /* insert a list item into the list (list may be null) */
593593 static list_item_t *
594 list_insert(list_item_t **listPtrPtr, const char *key, const char *value)
594 list_insert(
595 list_item_t **listPtrPtr,
596 const char *key,
597 const char *value)
595598 {
596599 list_item_t *itemPtr = malloc(sizeof(list_item_t));
597600 if (itemPtr) {
608611 }
609612
610613 static void
611 list_free(list_item_t **listPtrPtr)
614 list_free(
615 list_item_t **listPtrPtr)
612616 {
613617 list_item_t *tmpPtr, *listPtr = *listPtrPtr;
614618 while (listPtr) {
88 * See the file "license.terms" for information on usage and redistribution
99 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkWinButton.c,v 1.34 2007/12/14 15:56:09 patthoyts Exp $
11 * RCS: @(#) $Id: tkWinButton.c,v 1.36 2008/12/09 21:22:56 dgp Exp $
1212 */
1313
1414 #define OEMRESOURCE
257257 {
258258 Window window;
259259 HWND parent;
260 char *class;
260 const char *class;
261261 WinButton *butPtr = (WinButton *)instanceData;
262262
263263 parent = Tk_GetHWND(parentWin);
12861286 if (code != TCL_OK && code != TCL_CONTINUE
12871287 && code != TCL_BREAK) {
12881288 Tcl_AddErrorInfo(interp, "\n (button invoke)");
1289 Tcl_BackgroundError(interp);
1289 Tcl_BackgroundException(interp, code);
12901290 }
12911291 Tcl_Release((ClientData)interp);
12921292 }
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkWinClipboard.c,v 1.9 2007/01/11 15:35:40 dkf Exp $
11 * RCS: @(#) $Id: tkWinClipboard.c,v 1.10 2008/11/08 18:44:40 dkf Exp $
1212 */
1313
1414 #include "tkWinInt.h"
157157 * Pass the data off to the selection procedure.
158158 */
159159
160 result = (*proc)(clientData, interp, Tcl_DStringValue(&ds));
160 result = proc(clientData, interp, Tcl_DStringValue(&ds));
161161 Tcl_DStringFree(&ds);
162162 CloseClipboard();
163163 return result;
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkWinColor.c,v 1.11 2007/01/11 15:35:40 dkf Exp $
11 * RCS: @(#) $Id: tkWinColor.c,v 1.12 2008/10/17 23:18:38 nijtmans Exp $
1212 */
1313
1414 #include "tkWinInt.h"
3232 */
3333
3434 typedef struct {
35 char *name;
35 const char *name;
3636 int index;
3737 } SystemColorEntry;
3838
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkWinCursor.c,v 1.16 2008/04/27 22:39:14 dkf Exp $
10 * RCS: @(#) $Id: tkWinCursor.c,v 1.17 2008/10/17 23:18:38 nijtmans Exp $
1111 */
1212
1313 #include "tkWinInt.h"
3838 */
3939
4040 static struct CursorName {
41 char *name;
41 const char *name;
4242 LPCTSTR id;
4343 } cursorNames[] = {
4444 {"starting", IDC_APPSTARTING},
7070
7171 #define TK_DEFAULT_CURSOR IDC_ARROW
7272
73
73
7474 /*
7575 *----------------------------------------------------------------------
7676 *
170170 return (TkCursor *) cursorPtr;
171171 }
172172 }
173
173
174174 /*
175175 *----------------------------------------------------------------------
176176 *
199199 {
200200 return NULL;
201201 }
202
202
203203 /*
204204 *----------------------------------------------------------------------
205205 *
223223 {
224224 /* TkWinCursor *winCursorPtr = (TkWinCursor *) cursorPtr; */
225225 }
226
226
227227 /*
228228 *----------------------------------------------------------------------
229229 *
258258 SetCursor(hcursor);
259259 }
260260 }
261
261
262262 /*
263263 * Local Variables:
264264 * mode: c
88 * See the file "license.terms" for information on usage and redistribution
99 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkWinDefault.h,v 1.24 2007/12/13 15:28:55 dgp Exp $
11 * RCS: @(#) $Id: tkWinDefault.h,v 1.26 2008/12/06 10:48:29 dkf Exp $
1212 */
1313
1414 #ifndef _TKWINDEFAULT
6969 #define DEF_BUTTON_HIGHLIGHT HIGHLIGHT
7070 #define DEF_LABEL_HIGHLIGHT_WIDTH "0"
7171 #define DEF_BUTTON_HIGHLIGHT_WIDTH "1"
72 #define DEF_BUTTON_IMAGE (char *) NULL
72 #define DEF_BUTTON_IMAGE ((char *) NULL)
7373 #define DEF_BUTTON_INDICATOR "1"
7474 #define DEF_BUTTON_JUSTIFY "center"
7575 #define DEF_BUTTON_OFF_VALUE "0"
8585 #define DEF_BUTTON_REPEAT_INTERVAL "0"
8686 #define DEF_BUTTON_SELECT_COLOR INDICATOR
8787 #define DEF_BUTTON_SELECT_MONO BLACK
88 #define DEF_BUTTON_SELECT_IMAGE (char *) NULL
88 #define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
8989 #define DEF_BUTTON_STATE "normal"
9090 #define DEF_LABEL_TAKE_FOCUS "0"
91 #define DEF_BUTTON_TAKE_FOCUS (char *) NULL
91 #define DEF_BUTTON_TAKE_FOCUS ((char *) NULL)
9292 #define DEF_BUTTON_TEXT ""
9393 #define DEF_BUTTON_TEXT_VARIABLE ""
9494 #define DEF_BUTTON_TRISTATE_VALUE ""
127127 #define DEF_CANVAS_SELECT_BD_MONO "0"
128128 #define DEF_CANVAS_SELECT_FG_COLOR SELECT_FG
129129 #define DEF_CANVAS_SELECT_FG_MONO WHITE
130 #define DEF_CANVAS_TAKE_FOCUS (char *) NULL
130 #define DEF_CANVAS_TAKE_FOCUS ((char *) NULL)
131131 #define DEF_CANVAS_WIDTH "10c"
132132 #define DEF_CANVAS_X_SCROLL_CMD ""
133133 #define DEF_CANVAS_X_SCROLL_INCREMENT "0"
168168 #define DEF_ENTRY_SELECT_BD_MONO "0"
169169 #define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG
170170 #define DEF_ENTRY_SELECT_FG_MONO WHITE
171 #define DEF_ENTRY_SHOW (char *) NULL
171 #define DEF_ENTRY_SHOW ((char *) NULL)
172172 #define DEF_ENTRY_STATE "normal"
173 #define DEF_ENTRY_TAKE_FOCUS (char *) NULL
173 #define DEF_ENTRY_TAKE_FOCUS ((char *) NULL)
174174 #define DEF_ENTRY_TEXT_VARIABLE ""
175175 #define DEF_ENTRY_WIDTH "20"
176176
236236 #define DEF_LISTBOX_SELECT_MODE "browse"
237237 #define DEF_LISTBOX_SET_GRID "0"
238238 #define DEF_LISTBOX_STATE "normal"
239 #define DEF_LISTBOX_TAKE_FOCUS (char *) NULL
239 #define DEF_LISTBOX_TAKE_FOCUS ((char *) NULL)
240240 #define DEF_LISTBOX_WIDTH "20"
241241
242242 /*
243243 * Defaults for individual entries of menus:
244244 */
245245
246 #define DEF_MENU_ENTRY_ACTIVE_BG (char *) NULL
247 #define DEF_MENU_ENTRY_ACTIVE_FG (char *) NULL
248 #define DEF_MENU_ENTRY_ACCELERATOR (char *) NULL
249 #define DEF_MENU_ENTRY_BG (char *) NULL
246 #define DEF_MENU_ENTRY_ACTIVE_BG ((char *) NULL)
247 #define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL)
248 #define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL)
249 #define DEF_MENU_ENTRY_BG ((char *) NULL)
250250 #define DEF_MENU_ENTRY_BITMAP None
251251 #define DEF_MENU_ENTRY_COLUMN_BREAK "0"
252 #define DEF_MENU_ENTRY_COMMAND (char *) NULL
252 #define DEF_MENU_ENTRY_COMMAND ((char *) NULL)
253253 #define DEF_MENU_ENTRY_COMPOUND "none"
254 #define DEF_MENU_ENTRY_FG (char *) NULL
255 #define DEF_MENU_ENTRY_FONT (char *) NULL
254 #define DEF_MENU_ENTRY_FG ((char *) NULL)
255 #define DEF_MENU_ENTRY_FONT ((char *) NULL)
256256 #define DEF_MENU_ENTRY_HIDE_MARGIN "0"
257 #define DEF_MENU_ENTRY_IMAGE (char *) NULL
257 #define DEF_MENU_ENTRY_IMAGE ((char *) NULL)
258258 #define DEF_MENU_ENTRY_INDICATOR "1"
259 #define DEF_MENU_ENTRY_LABEL (char *) NULL
260 #define DEF_MENU_ENTRY_MENU (char *) NULL
259 #define DEF_MENU_ENTRY_LABEL ((char *) NULL)
260 #define DEF_MENU_ENTRY_MENU ((char *) NULL)
261261 #define DEF_MENU_ENTRY_OFF_VALUE "0"
262262 #define DEF_MENU_ENTRY_ON_VALUE "1"
263 #define DEF_MENU_ENTRY_SELECT_IMAGE (char *) NULL
263 #define DEF_MENU_ENTRY_SELECT_IMAGE ((char *) NULL)
264264 #define DEF_MENU_ENTRY_STATE "normal"
265 #define DEF_MENU_ENTRY_VALUE (char *) NULL
266 #define DEF_MENU_ENTRY_CHECK_VARIABLE (char *) NULL
265 #define DEF_MENU_ENTRY_VALUE ((char *) NULL)
266 #define DEF_MENU_ENTRY_CHECK_VARIABLE ((char *) NULL)
267267 #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
268 #define DEF_MENU_ENTRY_SELECT (char *) NULL
268 #define DEF_MENU_ENTRY_SELECT ((char *) NULL)
269269 #define DEF_MENU_ENTRY_UNDERLINE "-1"
270270
271271 /*
291291 #define DEF_MENU_SELECT_MONO BLACK
292292 #define DEF_MENU_TAKE_FOCUS "0"
293293 #define DEF_MENU_TEAROFF "1"
294 #define DEF_MENU_TEAROFF_CMD (char *) NULL
294 #define DEF_MENU_TEAROFF_CMD ((char *) NULL)
295295 #define DEF_MENU_TITLE ""
296296 #define DEF_MENU_TYPE "normal"
297297
319319 #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
320320 #define DEF_MENUBUTTON_HIGHLIGHT HIGHLIGHT
321321 #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
322 #define DEF_MENUBUTTON_IMAGE (char *) NULL
322 #define DEF_MENUBUTTON_IMAGE ((char *) NULL)
323323 #define DEF_MENUBUTTON_INDICATOR "0"
324324 #define DEF_MENUBUTTON_JUSTIFY "center"
325325 #define DEF_MENUBUTTON_MENU ""
419419 #define DEF_SCALE_LENGTH "100"
420420 #define DEF_SCALE_ORIENT "vertical"
421421 #define DEF_SCALE_RELIEF "flat"
422 #define DEF_SCALE_REPEAT_DELAY "300"
422 #define DEF_SCALE_REPEAT_DELAY "300"
423423 #define DEF_SCALE_REPEAT_INTERVAL "100"
424424 #define DEF_SCALE_RESOLUTION "1"
425425 #define DEF_SCALE_TROUGH_COLOR TROUGH
428428 #define DEF_SCALE_SLIDER_LENGTH "30"
429429 #define DEF_SCALE_SLIDER_RELIEF "raised"
430430 #define DEF_SCALE_STATE "normal"
431 #define DEF_SCALE_TAKE_FOCUS (char *) NULL
431 #define DEF_SCALE_TAKE_FOCUS ((char *) NULL)
432432 #define DEF_SCALE_TICK_INTERVAL "0"
433433 #define DEF_SCALE_TO "100"
434434 #define DEF_SCALE_VARIABLE ""
455455 #define DEF_SCROLLBAR_RELIEF "sunken"
456456 #define DEF_SCROLLBAR_REPEAT_DELAY "300"
457457 #define DEF_SCROLLBAR_REPEAT_INTERVAL "100"
458 #define DEF_SCROLLBAR_TAKE_FOCUS (char *) NULL
458 #define DEF_SCROLLBAR_TAKE_FOCUS ((char *) NULL)
459459 #define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
460460 #define DEF_SCROLLBAR_TROUGH_MONO WHITE
461461 #define DEF_SCROLLBAR_WIDTH "10"
482482 #define DEF_TEXT_INSERT_BD_MONO "0"
483483 #define DEF_TEXT_INSERT_OFF_TIME "300"
484484 #define DEF_TEXT_INSERT_ON_TIME "600"
485 #define DEF_TEXT_INSERT_UNFOCUSSED "none"
485486 #define DEF_TEXT_INSERT_WIDTH "2"
486 #define DEF_TEXT_MAX_UNDO "0"
487 #define DEF_TEXT_MAX_UNDO "0"
487488 #define DEF_TEXT_PADX "1"
488489 #define DEF_TEXT_PADY "1"
489490 #define DEF_TEXT_RELIEF "sunken"
502503 #define DEF_TEXT_STATE "normal"
503504 #define DEF_TEXT_TABS ""
504505 #define DEF_TEXT_TABSTYLE "tabular"
505 #define DEF_TEXT_TAKE_FOCUS (char *) NULL
506 #define DEF_TEXT_UNDO "0"
506 #define DEF_TEXT_TAKE_FOCUS ((char *) NULL)
507 #define DEF_TEXT_UNDO "0"
507508 #define DEF_TEXT_WIDTH "80"
508509 #define DEF_TEXT_WRAP "char"
509510 #define DEF_TEXT_XSCROLL_COMMAND ""
525526 #define DEF_TOPLEVEL_SCREEN ""
526527 #define DEF_TOPLEVEL_USE ""
527528
529 /*
530 * Defaults for busy windows:
531 */
532
533 #define DEF_BUSY_CURSOR "wait"
534
528535 #endif /* _TKWINDEFAULT */
77 * See the file "license.terms" for information on usage and redistribution of
88 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkWinDialog.c,v 1.53 2008/10/05 18:22:22 dkf Exp $
10 * RCS: @(#) $Id: tkWinDialog.c,v 1.59 2008/12/16 23:53:14 nijtmans Exp $
1111 *
1212 */
1313
1414 #include "tkWinInt.h"
1515 #include "tkFileFilter.h"
16 #include "tkFont.h"
1617
1718 #include <commdlg.h> /* includes common dialog functionality */
1819 #ifdef _MSC_VER
298299 static int inited = 0;
299300 static COLORREF dwCustColors[16];
300301 static long oldColor; /* the color selected last time */
301 static const char *optionStrings[] = {
302 static const char *const optionStrings[] = {
302303 "-initialcolor", "-parent", "-title", NULL
303304 };
304305 enum options {
466467 if ((title != NULL) && (title[0] != '\0')) {
467468 Tcl_DString ds;
468469
469 (*tkWinProcs->setWindowText)(hDlg,
470 Tcl_WinUtfToTChar(title, -1, &ds));
470 tkWinProcs->setWindowText(hDlg, Tcl_WinUtfToTChar(title,-1,&ds));
471471 Tcl_DStringFree(&ds);
472472 }
473473 if (tsdPtr->debugFlag) {
578578 Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
579579 ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
580580 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
581 static const char *saveOptionStrings[] = {
581 static const char *const saveOptionStrings[] = {
582582 "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
583583 "-parent", "-title", "-typevariable", NULL
584584 };
585 static const char *openOptionStrings[] = {
585 static const char *const openOptionStrings[] = {
586586 "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
587587 "-multiple", "-parent", "-title", "-typevariable", NULL
588588 };
589 const char **optionStrings;
589 const char *const *optionStrings;
590590
591591 enum options {
592592 FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE,
10221022 Tcl_DString extString, filterString, dirString, titleString;
10231023 ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
10241024 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
1025 static const char *saveOptionStrings[] = {
1025 static const char *const saveOptionStrings[] = {
10261026 "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
10271027 "-parent", "-title", "-typevariable", NULL
10281028 };
1029 static const char *openOptionStrings[] = {
1029 static const char *const openOptionStrings[] = {
10301030 "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
10311031 "-multiple", "-parent", "-title", "-typevariable", NULL
10321032 };
1033 const char **optionStrings;
1033 const char *const *optionStrings;
10341034
10351035 enum options {
10361036 FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE,
14841484 /*
14851485 * Use "All Files (*.*) as the default filter if none is specified
14861486 */
1487 char *defaultFilter = "All Files (*.*)";
1487 const char *defaultFilter = "All Files (*.*)";
14881488
14891489 p = filterStr = (char*)ckalloc(30 * sizeof(char));
14901490
15261526
15271527 for (filterPtr = flist.filters, p = filterStr; filterPtr;
15281528 filterPtr = filterPtr->next) {
1529 char *sep;
1529 const char *sep;
15301530 FileFilterClause *clausePtr;
15311531
15321532 /*
16901690 TCHAR saveDir[MAX_PATH];
16911691 Tcl_DString titleString; /* UTF Title */
16921692 Tcl_DString initDirString; /* Initial directory */
1693 static const char *optionStrings[] = {
1693 static const char *const optionStrings[] = {
16941694 "-initialdir", "-mustexist", "-parent", "-title", NULL
16951695 };
16961696 enum options {
20652065 int defaultBtn, icon, type;
20662066 int i, oldMode, winCode;
20672067 UINT flags;
2068 static const char *optionStrings[] = {
2068 static const char *const optionStrings[] = {
20692069 "-default", "-detail", "-icon", "-message",
20702070 "-parent", "-title", "-type", NULL
20712071 };
22582258 return CallNextHookEx(tsdPtr->hMsgBoxHook, nCode, wParam, lParam);
22592259 }
22602260
2261 /*
2262 * ----------------------------------------------------------------------
2263 *
2264 * SetTkDialog --
2265 *
2266 * Records the HWND for a native dialog in the 'tk_dialog' variable
2267 * so that the test-suite can operate on the correct dialog window.
2268 * Use of this is enabled when a test program calls TkWinDialogDebug
2269 * by calling the test command 'tkwinevent debug 1'
2270 *
2271 * ----------------------------------------------------------------------
2272 */
2273
22612274 static void
22622275 SetTkDialog(
22632276 ClientData clientData)
22962309 }
22972310
22982311 /*
2312 * ----------------------------------------------------------------------
2313 *
2314 * GetFontObj --
2315 *
2316 * Convert a windows LOGFONT into a Tk font description.
2317 *
2318 * Result:
2319 * A list containing a Tk font description.
2320 *
2321 * ----------------------------------------------------------------------
2322 */
2323
2324 static Tcl_Obj *
2325 GetFontObj(HDC hdc, LOGFONT *plf)
2326 {
2327 Tcl_Obj *resObj;
2328 int pt = 0;
2329
2330 resObj = Tcl_NewListObj(0, NULL);
2331 Tcl_ListObjAppendElement(NULL, resObj,
2332 Tcl_NewStringObj(plf->lfFaceName, -1));
2333 pt = -MulDiv(plf->lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY));
2334 Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewIntObj(pt));
2335 if (plf->lfWeight >= 700) {
2336 Tcl_ListObjAppendElement(NULL, resObj,
2337 Tcl_NewStringObj("bold", -1));
2338 }
2339 if (plf->lfItalic) {
2340 Tcl_ListObjAppendElement(NULL, resObj,
2341 Tcl_NewStringObj("italic", -1));
2342 }
2343 if (plf->lfUnderline) {
2344 Tcl_ListObjAppendElement(NULL, resObj,
2345 Tcl_NewStringObj("underline", -1));
2346 }
2347 if (plf->lfStrikeOut) {
2348 Tcl_ListObjAppendElement(NULL, resObj,
2349 Tcl_NewStringObj("overstrike", -1));
2350 }
2351 return resObj;
2352 }
2353
2354 static void
2355 ApplyLogfont(Tcl_Interp *interp, Tcl_Obj *cmdObj, HDC hdc, LOGFONT *logfontPtr)
2356 {
2357 int objc;
2358 Tcl_Obj **objv, **tmpv;
2359 Tcl_ListObjGetElements(NULL, cmdObj, &objc, &objv);
2360 tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2));
2361 memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc);
2362 tmpv[objc] = GetFontObj(hdc, logfontPtr);
2363 TkBackgroundEvalObjv(interp, objc+1, tmpv, TCL_EVAL_GLOBAL);
2364 ckfree((char *)tmpv);
2365 }
2366
2367 /*
2368 * ----------------------------------------------------------------------
2369 *
2370 * HookProc --
2371 *
2372 * Font selection hook. If the user selects Apply on the dialog, we
2373 * call the applyProc script with the currently selected font as
2374 * arguments.
2375 *
2376 * ----------------------------------------------------------------------
2377 */
2378
2379 typedef struct HookData {
2380 Tcl_Interp *interp;
2381 Tcl_Obj *titleObj;
2382 Tcl_Obj *cmdObj;
2383 Tcl_Obj *parentObj;
2384 Tcl_Obj *fontObj;
2385 HWND hwnd;
2386 Tk_Window parent;
2387 } HookData;
2388
2389 static UINT_PTR CALLBACK
2390 HookProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
2391 {
2392 CHOOSEFONT *pcf = (CHOOSEFONT *)lParam;
2393 HWND hwndCtrl;
2394 static HookData *phd = NULL;
2395 ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
2396 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
2397
2398 if (WM_INITDIALOG == msg && lParam != 0) {
2399 phd = (HookData *)pcf->lCustData;
2400 phd->hwnd = hwndDlg;
2401 if (tsdPtr->debugFlag) {
2402 tsdPtr->debugInterp = (Tcl_Interp *) phd->interp;
2403 Tcl_DoWhenIdle(SetTkDialog, (ClientData) hwndDlg);
2404 }
2405 if (phd->titleObj != NULL) {
2406 Tcl_DString title;
2407 Tcl_WinUtfToTChar(Tcl_GetString(phd->titleObj), -1, &title);
2408 if (Tcl_DStringLength(&title) > 0) {
2409 tkWinProcs->setWindowText(hwndDlg,
2410 (LPCTSTR)Tcl_DStringValue(&title));
2411 }
2412 Tcl_DStringFree(&title);
2413 }
2414
2415 /*
2416 * Disable the colour combobox (0x473) and its label (0x443).
2417 */
2418
2419 hwndCtrl = GetDlgItem(hwndDlg, 0x443);
2420 if (IsWindow(hwndCtrl)) {
2421 EnableWindow(hwndCtrl, FALSE);
2422 }
2423 hwndCtrl = GetDlgItem(hwndDlg, 0x473);
2424 if (IsWindow(hwndCtrl)) {
2425 EnableWindow(hwndCtrl, FALSE);
2426 }
2427 TkSendVirtualEvent(phd->parent, "TkFontchooserVisibility");
2428 return 1; /* we handled the message */
2429 }
2430
2431 if (WM_DESTROY == msg) {
2432 phd->hwnd = NULL;
2433 TkSendVirtualEvent(phd->parent, "TkFontchooserVisibility");
2434 return 0;
2435 }
2436
2437 /*
2438 * Handle apply button by calling the provided command script as
2439 * a background evaluation (ie: errors dont come back here).
2440 */
2441 if (WM_COMMAND == msg && LOWORD(wParam) == 1026) {
2442 LOGFONT lf = {0};
2443 HDC hdc = GetDC(hwndDlg);
2444 SendMessage(hwndDlg, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM)&lf);
2445 if (phd && phd->cmdObj) {
2446 ApplyLogfont(phd->interp, phd->cmdObj, hdc, &lf);
2447 }
2448 if (phd && phd->parent) {
2449 TkSendVirtualEvent(phd->parent, "TkFontchooserFontChanged");
2450 }
2451 return 1;
2452 }
2453 return 0; /* pass on for default processing */
2454 }
2455
2456 /*
2457 * Helper for the FontchooserConfigure command to return the
2458 * current value of any of the options (which may be NULL in
2459 * the structure)
2460 */
2461
2462 enum FontchooserOption {
2463 FontchooserParent, FontchooserTitle, FontchooserFont, FontchooserCmd,
2464 FontchooserVisible
2465 };
2466
2467 static Tcl_Obj *
2468 FontchooserCget(HookData *hdPtr, int optionIndex)
2469 {
2470 Tcl_Obj *resObj = NULL;
2471 switch(optionIndex) {
2472 case FontchooserParent: {
2473 if (hdPtr->parentObj) {
2474 resObj = hdPtr->parentObj;
2475 } else {
2476 resObj = Tcl_NewStringObj(".", 1);
2477 }
2478 break;
2479 }
2480 case FontchooserTitle: {
2481 if (hdPtr->titleObj) {
2482 resObj = hdPtr->titleObj;
2483 } else {
2484 resObj = Tcl_NewStringObj("", 0);
2485 }
2486 break;
2487 }
2488 case FontchooserFont: {
2489 if (hdPtr->fontObj) {
2490 resObj = hdPtr->fontObj;
2491 } else {
2492 resObj = Tcl_NewStringObj("", 0);
2493 }
2494 break;
2495 }
2496 case FontchooserCmd: {
2497 if (hdPtr->cmdObj) {
2498 resObj = hdPtr->cmdObj;
2499 } else {
2500 resObj = Tcl_NewStringObj("", 0);
2501 }
2502 break;
2503 }
2504 case FontchooserVisible: {
2505 resObj = Tcl_NewBooleanObj(hdPtr->hwnd && IsWindow(hdPtr->hwnd));
2506 break;
2507 }
2508 default: {
2509 resObj = Tcl_NewStringObj("", 0);
2510 }
2511 }
2512 return resObj;
2513 }
2514
2515 /*
2516 * ----------------------------------------------------------------------
2517 *
2518 * FontchooserConfigureCmd --
2519 *
2520 * Implementation of the 'tk fontchooser configure' ensemble command.
2521 * See the user documentation for what it does.
2522 *
2523 * Results:
2524 * See the user documentation.
2525 *
2526 * Side effects:
2527 * Per-interp data structure may be modified
2528 *
2529 * ----------------------------------------------------------------------
2530 */
2531
2532 static int
2533 FontchooserConfigureCmd(
2534 ClientData clientData, /* Main window */
2535 Tcl_Interp *interp,
2536 int objc,
2537 Tcl_Obj *const objv[])
2538 {
2539 Tk_Window tkwin = (Tk_Window)clientData;
2540 HookData *hdPtr = NULL;
2541 int i, r = TCL_OK;
2542 static const char *optionStrings[] = {
2543 "-parent", "-title", "-font", "-command", "-visible", NULL
2544 };
2545
2546 hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
2547
2548 /*
2549 * with no arguments we return all the options in a dict
2550 */
2551
2552 if (objc == 1) {
2553 Tcl_Obj *keyObj, *valueObj;
2554 Tcl_Obj *dictObj = Tcl_NewDictObj();
2555 for (i = 0; r == TCL_OK && optionStrings[i] != NULL; ++i) {
2556 keyObj = Tcl_NewStringObj(optionStrings[i], -1);
2557 valueObj = FontchooserCget(hdPtr, i);
2558 r = Tcl_DictObjPut(interp, dictObj, keyObj, valueObj);
2559 }
2560 if (r == TCL_OK) {
2561 Tcl_SetObjResult(interp, dictObj);
2562 }
2563 return r;
2564 }
2565
2566 for (i = 1; i < objc; i += 2) {
2567 int optionIndex, len;
2568 if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
2569 "option", 0, &optionIndex) != TCL_OK) {
2570 return TCL_ERROR;
2571 }
2572 if (objc == 2) {
2573 /* if one option and no arg - return the current value */
2574 Tcl_SetObjResult(interp, FontchooserCget(hdPtr, optionIndex));
2575 return TCL_OK;
2576 }
2577 if (i + 1 == objc) {
2578 Tcl_AppendResult(interp, "value for \"",
2579 Tcl_GetString(objv[i]), "\" missing", NULL);
2580 return TCL_ERROR;
2581 }
2582 switch (optionIndex) {
2583 case FontchooserVisible: {
2584 const char *msg = "cannot change read-only option "
2585 "\"-visible\": use the show or hide command";
2586 Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, -1));
2587 return TCL_ERROR;
2588 }
2589 case FontchooserParent: {
2590 Tk_Window parent = Tk_NameToWindow(interp,
2591 Tcl_GetString(objv[i+1]), tkwin);
2592 if (parent == None) {
2593 return TCL_ERROR;
2594 }
2595 if (hdPtr->parentObj) {
2596 Tcl_DecrRefCount(hdPtr->parentObj);
2597 }
2598 hdPtr->parentObj = objv[i+1];
2599 if (Tcl_IsShared(hdPtr->parentObj)) {
2600 hdPtr->parentObj = Tcl_DuplicateObj(hdPtr->parentObj);
2601 }
2602 Tcl_IncrRefCount(hdPtr->parentObj);
2603 break;
2604 }
2605 case FontchooserTitle: {
2606 if (hdPtr->titleObj) {
2607 Tcl_DecrRefCount(hdPtr->titleObj);
2608 }
2609 hdPtr->titleObj = objv[i+1];
2610 if (Tcl_IsShared(hdPtr->titleObj)) {
2611 hdPtr->titleObj = Tcl_DuplicateObj(hdPtr->titleObj);
2612 }
2613 Tcl_IncrRefCount(hdPtr->titleObj);
2614 break;
2615 }
2616 case FontchooserFont: {
2617 if (hdPtr->fontObj) {
2618 Tcl_DecrRefCount(hdPtr->fontObj);
2619 }
2620 Tcl_GetStringFromObj(objv[i+1], &len);
2621 if (len) {
2622 hdPtr->fontObj = objv[i+1];
2623 if (Tcl_IsShared(hdPtr->fontObj)) {
2624 hdPtr->fontObj = Tcl_DuplicateObj(hdPtr->fontObj);
2625 }
2626 Tcl_IncrRefCount(hdPtr->fontObj);
2627 } else {
2628 hdPtr->fontObj = NULL;
2629 }
2630 break;
2631 }
2632 case FontchooserCmd: {
2633 if (hdPtr->cmdObj) {
2634 Tcl_DecrRefCount(hdPtr->cmdObj);
2635 }
2636 Tcl_GetStringFromObj(objv[i+1], &len);
2637 if (len) {
2638 hdPtr->cmdObj = objv[i+1];
2639 if (Tcl_IsShared(hdPtr->cmdObj)) {
2640 hdPtr->cmdObj = Tcl_DuplicateObj(hdPtr->cmdObj);
2641 }
2642 Tcl_IncrRefCount(hdPtr->cmdObj);
2643 } else {
2644 hdPtr->cmdObj = NULL;
2645 }
2646 break;
2647 }
2648 }
2649 }
2650 return TCL_OK;
2651 }
2652
2653 /*
2654 * ----------------------------------------------------------------------
2655 *
2656 * FontchooserShowCmd --
2657 *
2658 * Implements the 'tk fontchooser show' ensemble command. The
2659 * per-interp configuration data for the dialog is held in an interp
2660 * associated structure.
2661 * Calls the Win32 FontChooser API which provides a modal dialog.
2662 * See HookProc where we make a few changes to the dialog and set
2663 * some additional state.
2664 *
2665 * ----------------------------------------------------------------------
2666 */
2667
2668 static int
2669 FontchooserShowCmd(
2670 ClientData clientData, /* Main window */
2671 Tcl_Interp *interp,
2672 int objc,
2673 Tcl_Obj *const objv[])
2674 {
2675 Tk_Window tkwin, parent;
2676 CHOOSEFONT cf;
2677 LOGFONT lf;
2678 HDC hdc;
2679 HookData *hdPtr;
2680 int r = TCL_OK, oldMode = 0;
2681
2682 hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
2683
2684 tkwin = parent = (Tk_Window) clientData;
2685 if (hdPtr->parentObj) {
2686 parent = Tk_NameToWindow(interp, Tcl_GetString(hdPtr->parentObj), tkwin);
2687 if (parent == None) {
2688 return TCL_ERROR;
2689 }
2690 }
2691
2692 Tk_MakeWindowExist(parent);
2693
2694 ZeroMemory(&cf, sizeof(CHOOSEFONT));
2695 ZeroMemory(&lf, sizeof(LOGFONT));
2696 lf.lfCharSet = DEFAULT_CHARSET;
2697 cf.lStructSize = sizeof(CHOOSEFONT);
2698 cf.hwndOwner = Tk_GetHWND(Tk_WindowId(parent));
2699 cf.lpLogFont = &lf;
2700 cf.nFontType = SCREEN_FONTTYPE;
2701 cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_ENABLEHOOK;
2702 cf.rgbColors = RGB(0,0,0);
2703 cf.lpfnHook = HookProc;
2704 cf.lCustData = (INT_PTR)hdPtr;
2705 hdPtr->interp = interp;
2706 hdPtr->parent = parent;
2707 hdc = GetDC(cf.hwndOwner);
2708
2709 if (hdPtr->fontObj != NULL) {
2710 TkFont *fontPtr;
2711 Tk_Font f = Tk_AllocFontFromObj(interp, tkwin, hdPtr->fontObj);
2712 if (f == NULL) {
2713 return TCL_ERROR;
2714 }
2715 fontPtr = (TkFont *)f;
2716 cf.Flags |= CF_INITTOLOGFONTSTRUCT;
2717 strncpy(lf.lfFaceName, Tk_GetUid(fontPtr->fa.family), LF_FACESIZE-1);
2718 lf.lfFaceName[LF_FACESIZE-1] = 0;
2719 lf.lfHeight = -MulDiv(TkFontGetPoints(tkwin, fontPtr->fa.size),
2720 GetDeviceCaps(hdc, LOGPIXELSY), 72);
2721 if (fontPtr->fa.weight == TK_FW_BOLD) lf.lfWeight = FW_BOLD;
2722 if (fontPtr->fa.slant != TK_FS_ROMAN) lf.lfItalic = TRUE;
2723 if (fontPtr->fa.underline) lf.lfUnderline = TRUE;
2724 if (fontPtr->fa.overstrike) lf.lfStrikeOut = TRUE;
2725 Tk_FreeFont(f);
2726 }
2727
2728 if (TCL_OK == r && hdPtr->cmdObj != NULL) {
2729 int len = 0;
2730 r = Tcl_ListObjLength(interp, hdPtr->cmdObj, &len);
2731 if (len > 0) cf.Flags |= CF_APPLY;
2732 }
2733
2734 if (TCL_OK == r) {
2735 oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
2736 if (ChooseFont(&cf)) {
2737 if (hdPtr->cmdObj) {
2738 ApplyLogfont(hdPtr->interp, hdPtr->cmdObj, hdc, &lf);
2739 }
2740 if (hdPtr->parent) {
2741 TkSendVirtualEvent(hdPtr->parent, "TkFontchooserFontChanged");
2742 }
2743 }
2744 Tcl_SetServiceMode(oldMode);
2745 EnableWindow(cf.hwndOwner, 1);
2746 }
2747
2748 ReleaseDC(cf.hwndOwner, hdc);
2749
2750 return r;
2751 }
2752
2753 /*
2754 * ----------------------------------------------------------------------
2755 *
2756 * FontchooserHideCmd --
2757 *
2758 * Implementation of the 'tk fontchooser hide' ensemble. See the
2759 * user documentation for details.
2760 * As the Win32 FontChooser function is always modal all we do here
2761 * is destroy the dialog
2762 *
2763 * ----------------------------------------------------------------------
2764 */
2765
2766 static int
2767 FontchooserHideCmd(
2768 ClientData clientData, /* Main window */
2769 Tcl_Interp *interp,
2770 int objc,
2771 Tcl_Obj *const objv[])
2772 {
2773 HookData *hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
2774 if (hdPtr->hwnd && IsWindow(hdPtr->hwnd)) {
2775 EndDialog(hdPtr->hwnd, 0);
2776 }
2777 return TCL_OK;
2778 }
2779
2780 /*
2781 * ----------------------------------------------------------------------
2782 *
2783 * DeleteHookData --
2784 *
2785 * Clean up the font chooser configuration data when the interp
2786 * is destroyed.
2787 *
2788 * ----------------------------------------------------------------------
2789 */
2790
2791 static void
2792 DeleteHookData(ClientData clientData, Tcl_Interp *interp)
2793 {
2794 HookData *hdPtr = clientData;
2795 if (hdPtr->parentObj)
2796 Tcl_DecrRefCount(hdPtr->parentObj);
2797 if (hdPtr->fontObj)
2798 Tcl_DecrRefCount(hdPtr->fontObj);
2799 if (hdPtr->titleObj)
2800 Tcl_DecrRefCount(hdPtr->titleObj);
2801 if (hdPtr->cmdObj)
2802 Tcl_DecrRefCount(hdPtr->cmdObj);
2803 ckfree((char *)hdPtr);
2804 }
2805
2806 /*
2807 * ----------------------------------------------------------------------
2808 *
2809 * TkInitFontchooser --
2810 *
2811 * Associate the font chooser configuration data with the Tcl
2812 * interpreter. There is one font chooser per interp.
2813 *
2814 * ----------------------------------------------------------------------
2815 */
2816
2817 MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[];
2818 const TkEnsemble tkFontchooserEnsemble[] = {
2819 { "configure", FontchooserConfigureCmd, NULL },
2820 { "show", FontchooserShowCmd, NULL },
2821 { "hide", FontchooserHideCmd, NULL },
2822 { NULL, NULL, NULL }
2823 };
2824
2825 int
2826 TkInitFontchooser(Tcl_Interp *interp, ClientData clientData)
2827 {
2828 HookData *hdPtr = NULL;
2829 hdPtr = (HookData *)ckalloc(sizeof(HookData));
2830 memset(hdPtr, 0, sizeof(HookData));
2831 Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteHookData, hdPtr);
2832 return TCL_OK;
2833 }
2834
2835 /*
22992836 * Local Variables:
23002837 * mode: c
23012838 * c-basic-offset: 4
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkWinDraw.c,v 1.21 2008/04/27 22:39:16 dkf Exp $
12 * RCS: @(#) $Id: tkWinDraw.c,v 1.23 2008/11/22 20:05:32 patthoyts Exp $
1313 */
1414
1515 #include "tkWinInt.h"
1818 * These macros convert between X's bizarre angle units to radians.
1919 */
2020
21 #define PI 3.14159265358979
2221 #define XAngleToRadians(a) ((double)(a) / 64 * PI / 180);
2322
2423 /*
813812 SetPolyFillMode(dcMem, (gc->fill_rule == EvenOddRule) ? ALTERNATE
814813 : WINDING);
815814 oldMemBrush = SelectObject(dcMem, CreateSolidBrush(gc->foreground));
816 (*func)(dcMem, winPoints, npoints);
815 func(dcMem, winPoints, npoints);
817816 BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0, COPYFG);
818817
819818 /*
825824 if (gc->fill_style == FillOpaqueStippled) {
826825 DeleteObject(SelectObject(dcMem,
827826 CreateSolidBrush(gc->background)));
828 (*func)(dcMem, winPoints, npoints);
827 func(dcMem, winPoints, npoints);
829828 BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0,
830829 COPYBG);
831830 }
841840
842841 SetPolyFillMode(dc, (gc->fill_rule == EvenOddRule) ? ALTERNATE
843842 : WINDING);
844
845 (*func)(dc, winPoints, npoints);
846
843 func(dc, winPoints, npoints);
847844 SelectObject(dc, oldPen);
848845 }
849846 DeleteObject(SelectObject(dc, oldBrush));
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkWinFont.c,v 1.40 2008/10/05 18:22:22 dkf Exp $
13 * RCS: @(#) $Id: tkWinFont.c,v 1.45 2008/11/22 20:05:32 patthoyts Exp $
1414 */
1515
1616 #include "tkWinInt.h"
5151 int isSymbolFont; /* Non-zero if this is a symbol font. */
5252 int isWideFont; /* 1 if this is a double-byte font, 0
5353 * otherwise. */
54 BOOL (WINAPI *textOutProc)(HDC, int, int, TCHAR *, int);
54 BOOL (WINAPI *textOutProc)(HDC hdc, int x, int y, TCHAR *str, int len);
5555 /* The procedure to use to draw text after it
5656 * has been converted from UTF-8 to the
5757 * encoding of this font. */
9595 typedef struct SubFont {
9696 char **fontMap; /* Pointer to font map from the FontFamily,
9797 * cached here to save a dereference. */
98 HFONT hFont; /* The specific screen font that will be used
98 HFONT hFont0; /* The specific screen font that will be used
9999 * when displaying/measuring chars belonging
100100 * to the FontFamily. */
101101 FontFamily *familyPtr; /* The FontFamily for this SubFont. */
102 HFONT hFontAngled;
103 double angle;
102104 } SubFont;
103105
104106 /*
124126 * attributes. Usually points to
125127 * staticSubFonts, but may point to malloced
126128 * space if there are lots of SubFonts. */
127
128129 HWND hwnd; /* Toplevel window of application that owns
129130 * this font, used for getting HDC for
130131 * offscreen measurements. */
190191
191192 static FontFamily * AllocFontFamily(HDC hdc, HFONT hFont, int base);
192193 static SubFont * CanUseFallback(HDC hdc, WinFont *fontPtr,
193 char *fallbackName, int ch,
194 const char *fallbackName, int ch,
194195 SubFont **subFontPtrPtr);
195196 static SubFont * CanUseFallbackWithAliases(HDC hdc, WinFont *fontPtr,
196 char *faceName, int ch, Tcl_DString *nameTriedPtr,
197 const char *faceName, int ch,
198 Tcl_DString *nameTriedPtr,
197199 SubFont **subFontPtrPtr);
198200 static int FamilyExists(HDC hdc, const char *faceName);
199 static char * FamilyOrAliasExists(HDC hdc, const char *faceName);
201 static const char * FamilyOrAliasExists(HDC hdc, const char *faceName);
200202 static SubFont * FindSubFontForChar(WinFont *fontPtr, int ch,
201203 SubFont **subFontPtrPtr);
202204 static void FontMapInsert(SubFont *subFontPtr, int ch);
204206 static int FontMapLookup(SubFont *subFontPtr, int ch);
205207 static void FreeFontFamily(FontFamily *familyPtr);
206208 static HFONT GetScreenFont(const TkFontAttributes *faPtr,
207 const char *faceName, int pixelSize);
209 const char *faceName, int pixelSize,
210 double angle);
208211 static void InitFont(Tk_Window tkwin, HFONT hFont,
209212 int overstrike, WinFont *tkFontPtr);
210 static void InitSubFont(HDC hdc, HFONT hFont, int base,
213 static inline void InitSubFont(HDC hdc, HFONT hFont, int base,
211214 SubFont *subFontPtr);
212215 static int CreateNamedSystemLogFont(Tcl_Interp *interp,
213216 Tk_Window tkwin, const char* name,
218221 USHORT **startCount, USHORT **endCount,
219222 int *symbolPtr);
220223 static void MultiFontTextOut(HDC hdc, WinFont *fontPtr,
221 const char *source, int numBytes, int x, int y);
224 const char *source, int numBytes, int x, int y,
225 double angle);
222226 static void ReleaseFont(WinFont *fontPtr);
223 static void ReleaseSubFont(SubFont *subFontPtr);
227 static inline void ReleaseSubFont(SubFont *subFontPtr);
224228 static int SeenName(const char *name, Tcl_DString *dsPtr);
225 static void SwapLong(PULONG p);
226 static void SwapShort(USHORT *p);
229 static inline HFONT SelectFont(HDC hdc, WinFont *fontPtr,
230 SubFont *subFontPtr, double angle);
231 static inline void SwapLong(PULONG p);
232 static inline void SwapShort(USHORT *p);
227233 static int CALLBACK WinFontCanUseProc(ENUMLOGFONT *lfPtr,
228234 NEWTEXTMETRIC *tmPtr, int fontType,
229235 LPARAM lParam);
318324
319325 /*
320326 *---------------------------------------------------------------------------
327 *
321328 * CreateNamedSystemFont --
322329 *
323330 * This function registers a Windows logical font description with the Tk
324331 * named font mechanism.
325332 *
326 * Side effects
327 *
333 * Side effects:
328334 * A new named font is added to the Tk font registry.
329335 *
330336 *---------------------------------------------------------------------------
339345 {
340346 HFONT hFont;
341347 int r;
342
348
343349 hFont = CreateFontIndirect(logFontPtr);
344350 r = CreateNamedSystemFont(interp, tkwin, name, hFont);
345351 DeleteObject((HGDIOBJ)hFont);
348354
349355 /*
350356 *---------------------------------------------------------------------------
357 *
351358 * CreateNamedSystemFont --
352359 *
353 * This function registers a Windows font with the Tk
354 * named font mechanism.
355 *
356 * Side effects
357 *
360 * This function registers a Windows font with the Tk named font
361 * mechanism.
362 *
363 * Side effects:
358364 * A new named font is added to the Tk font registry.
359365 *
360366 *---------------------------------------------------------------------------
369375 {
370376 WinFont winfont;
371377 int r;
372
378
373379 TkDeleteNamedFont(NULL, tkwin, name);
374380 InitFont(tkwin, hFont, 0, &winfont);
375381 r = TkCreateNamedFont(interp, tkwin, name, &winfont.font.fa);
379385
380386 /*
381387 *---------------------------------------------------------------------------
388 *
382389 * TkWinSystemFonts --
383390 *
384391 * Create some platform specific named fonts that to give access to the
385 * system fonts. These are all defined for the Windows desktop parameters.
392 * system fonts. These are all defined for the Windows desktop
393 * parameters.
386394 *
387395 *---------------------------------------------------------------------------
388396 */
389397
390398 void
391 TkWinSetupSystemFonts(TkMainInfo *mainPtr)
399 TkWinSetupSystemFonts(
400 TkMainInfo *mainPtr)
392401 {
393402 Tcl_Interp *interp;
394403 Tk_Window tkwin;
442451 hFont = (HFONT) GetStockObject(ANSI_FIXED_FONT);
443452 CreateNamedSystemFont(interp, tkwin, "TkFixedFont", hFont);
444453
445 /*
454 /*
446455 * Setup the remaining standard Tk font names as named fonts.
447456 */
448457
499508 HFONT hFont;
500509 Window window;
501510 WinFont *fontPtr;
502 char ***fontFallbacks;
511 const char *const *const *fontFallbacks;
503512 Tk_Uid faceName, fallback, actualName;
504513
505514 tkwin = (Tk_Window) ((TkWindow *) tkwin)->mainPtr->winPtr;
547556 ReleaseDC(hwnd, hdc);
548557
549558 hFont = GetScreenFont(faPtr, faceName,
550 TkFontGetPixels(tkwin, faPtr->size));
559 TkFontGetPixels(tkwin, faPtr->size), 0.0);
551560 if (tkFontPtr == NULL) {
552561 fontPtr = (WinFont *) ckalloc(sizeof(WinFont));
553562 } else {
725734 Tk_Window tkwin, /* Window on the font's display */
726735 Tk_Font tkfont, /* Font to query */
727736 Tcl_UniChar c, /* Character of interest */
728 TkFontAttributes* faPtr) /* Output: Font attributes */
737 TkFontAttributes *faPtr) /* Output: Font attributes */
729738 {
730739 WinFont *fontPtr = (WinFont *) tkfont;
731740 /* Structure describing the logical font */
733742 /* GDI device context */
734743 SubFont *lastSubFontPtr = &fontPtr->subFontArray[0];
735744 /* Pointer to subfont array in case
736 * FindSubFontForChar needs to fix up
737 * the memory allocation */
738 SubFont *thisSubFontPtr = FindSubFontForChar(fontPtr, c,
739 &lastSubFontPtr);
740 /* Pointer to the subfont to use for
741 * the given character */
745 * FindSubFontForChar needs to fix up the
746 * memory allocation */
747 SubFont *thisSubFontPtr =
748 FindSubFontForChar(fontPtr, c, &lastSubFontPtr);
749 /* Pointer to the subfont to use for the given
750 * character */
742751 FontFamily *familyPtr = thisSubFontPtr->familyPtr;
743752 HFONT oldfont; /* Saved font from the device context */
744753 TEXTMETRIC tm; /* Font metrics of the selected subfont */
747756 * Get the font attributes.
748757 */
749758
750 oldfont = SelectObject(hdc, thisSubFontPtr->hFont);
759 oldfont = SelectObject(hdc, thisSubFontPtr->hFont0);
751760 GetTextMetrics(hdc, &tm);
752761 SelectObject(hdc, oldfont);
753762 ReleaseDC(fontPtr->hwnd, hdc);
825834
826835 hdc = GetDC(fontPtr->hwnd);
827836 lastSubFontPtr = &fontPtr->subFontArray[0];
828 oldFont = SelectObject(hdc, lastSubFontPtr->hFont);
837 oldFont = SelectObject(hdc, lastSubFontPtr->hFont0);
829838
830839 /*
831840 * A three step process:
847856 Tcl_UtfToExternalDString(familyPtr->encoding, start,
848857 (int) (p - start), &runString);
849858 size.cx = 0;
850 (*familyPtr->getTextExtentPoint32Proc)(hdc,
859 familyPtr->getTextExtentPoint32Proc(hdc,
851860 Tcl_DStringValue(&runString),
852861 Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
853862 &size);
860869 lastSubFontPtr = thisSubFontPtr;
861870 start = p;
862871
863 SelectObject(hdc, lastSubFontPtr->hFont);
872 SelectObject(hdc, lastSubFontPtr->hFont0);
864873 }
865874 p = next;
866875 }
875884 Tcl_UtfToExternalDString(familyPtr->encoding, start,
876885 (int) (p - start), &runString);
877886 size.cx = 0;
878 (*familyPtr->getTextExtentPoint32Proc)(hdc,
879 Tcl_DStringValue(&runString),
887 familyPtr->getTextExtentPoint32Proc(hdc, Tcl_DStringValue(&runString),
880888 Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
881889 &size);
882890 Tcl_DStringFree(&runString);
909917 &dstWrote, NULL);
910918 Tcl_DStringAppend(&runString,buf,dstWrote);
911919 size.cx = 0;
912 (*familyPtr->getTextExtentPoint32Proc)(hdc,
920 familyPtr->getTextExtentPoint32Proc(hdc,
913921 Tcl_DStringValue(&runString),
914922 Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
915923 &size);
10891097 SetROP2(dc, tkpWinRopModes[gc->function]);
10901098
10911099 if ((gc->clip_mask != None) &&
1092 ((TkpClipMask*)gc->clip_mask)->type == TKP_CLIP_REGION) {
1093 SelectClipRgn(dc, (HRGN)((TkpClipMask*)gc->clip_mask)->value.region);
1100 ((TkpClipMask *) gc->clip_mask)->type == TKP_CLIP_REGION) {
1101 SelectClipRgn(dc, (HRGN)((TkpClipMask *)gc->clip_mask)->value.region);
1102 }
1103
1104 if ((gc->fill_style == FillStippled
1105 || gc->fill_style == FillOpaqueStippled)
1106 && gc->stipple != None) {
1107 TkWinDrawable *twdPtr = (TkWinDrawable *) gc->stipple;
1108 HBRUSH oldBrush, stipple;
1109 HBITMAP oldBitmap, bitmap;
1110 HDC dcMem;
1111 TEXTMETRIC tm;
1112 SIZE size;
1113
1114 if (twdPtr->type != TWD_BITMAP) {
1115 Tcl_Panic("unexpected drawable type in stipple");
1116 }
1117
1118 /*
1119 * Select stipple pattern into destination dc.
1120 */
1121
1122 dcMem = CreateCompatibleDC(dc);
1123
1124 stipple = CreatePatternBrush(twdPtr->bitmap.handle);
1125 SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
1126 oldBrush = SelectObject(dc, stipple);
1127
1128 SetTextAlign(dcMem, TA_LEFT | TA_BASELINE);
1129 SetTextColor(dcMem, gc->foreground);
1130 SetBkMode(dcMem, TRANSPARENT);
1131 SetBkColor(dcMem, RGB(0, 0, 0));
1132
1133 /*
1134 * Compute the bounding box and create a compatible bitmap.
1135 */
1136
1137 GetTextExtentPoint(dcMem, source, numBytes, &size);
1138 GetTextMetrics(dcMem, &tm);
1139 size.cx -= tm.tmOverhang;
1140 bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
1141 oldBitmap = SelectObject(dcMem, bitmap);
1142
1143 /*
1144 * The following code is tricky because fonts are rendered in multiple
1145 * colors. First we draw onto a black background and copy the white
1146 * bits. Then we draw onto a white background and copy the black bits.
1147 * Both the foreground and background bits of the font are ANDed with
1148 * the stipple pattern as they are copied.
1149 */
1150
1151 PatBlt(dcMem, 0, 0, size.cx, size.cy, BLACKNESS);
1152 MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, 0.0);
1153 BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem,
1154 0, 0, 0xEA02E9);
1155 PatBlt(dcMem, 0, 0, size.cx, size.cy, WHITENESS);
1156 MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, 0.0);
1157 BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem,
1158 0, 0, 0x8A0E06);
1159
1160 /*
1161 * Destroy the temporary bitmap and restore the device context.
1162 */
1163
1164 SelectObject(dcMem, oldBitmap);
1165 DeleteObject(bitmap);
1166 DeleteDC(dcMem);
1167 SelectObject(dc, oldBrush);
1168 DeleteObject(stipple);
1169 } else if (gc->function == GXcopy) {
1170 SetTextAlign(dc, TA_LEFT | TA_BASELINE);
1171 SetTextColor(dc, gc->foreground);
1172 SetBkMode(dc, TRANSPARENT);
1173 MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, 0.0);
1174 } else {
1175 HBITMAP oldBitmap, bitmap;
1176 HDC dcMem;
1177 TEXTMETRIC tm;
1178 SIZE size;
1179
1180 dcMem = CreateCompatibleDC(dc);
1181
1182 SetTextAlign(dcMem, TA_LEFT | TA_BASELINE);
1183 SetTextColor(dcMem, gc->foreground);
1184 SetBkMode(dcMem, TRANSPARENT);
1185 SetBkColor(dcMem, RGB(0, 0, 0));
1186
1187 /*
1188 * Compute the bounding box and create a compatible bitmap.
1189 */
1190
1191 GetTextExtentPoint(dcMem, source, numBytes, &size);
1192 GetTextMetrics(dcMem, &tm);
1193 size.cx -= tm.tmOverhang;
1194 bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
1195 oldBitmap = SelectObject(dcMem, bitmap);
1196
1197 MultiFontTextOut(dcMem, fontPtr, source, numBytes, 0, tm.tmAscent,
1198 0.0);
1199 BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem,
1200 0, 0, (DWORD) tkpWinBltModes[gc->function]);
1201
1202 /*
1203 * Destroy the temporary bitmap and restore the device context.
1204 */
1205
1206 SelectObject(dcMem, oldBitmap);
1207 DeleteObject(bitmap);
1208 DeleteDC(dcMem);
1209 }
1210 TkWinReleaseDrawableDC(drawable, dc, &state);
1211 }
1212
1213 void
1214 TkpDrawAngledChars(
1215 Display *display, /* Display on which to draw. */
1216 Drawable drawable, /* Window or pixmap in which to draw. */
1217 GC gc, /* Graphics context for drawing characters. */
1218 Tk_Font tkfont, /* Font in which characters will be drawn;
1219 * must be the same as font used in GC. */
1220 const char *source, /* UTF-8 string to be displayed. Need not be
1221 * '\0' terminated. All Tk meta-characters
1222 * (tabs, control characters, and newlines)
1223 * should be stripped out of the string that
1224 * is passed to this function. If they are not
1225 * stripped out, they will be displayed as
1226 * regular printing characters. */
1227 int numBytes, /* Number of bytes in string. */
1228 double x, double y, /* Coordinates at which to place origin of
1229 * string when drawing. */
1230 double angle)
1231 {
1232 HDC dc;
1233 WinFont *fontPtr;
1234 TkWinDCState state;
1235
1236 fontPtr = (WinFont *) gc->font;
1237 display->request++;
1238
1239 if (drawable == None) {
1240 return;
1241 }
1242
1243 dc = TkWinGetDrawableDC(display, drawable, &state);
1244
1245 SetROP2(dc, tkpWinRopModes[gc->function]);
1246
1247 if ((gc->clip_mask != None) &&
1248 ((TkpClipMask *) gc->clip_mask)->type == TKP_CLIP_REGION) {
1249 SelectClipRgn(dc, (HRGN)((TkpClipMask *)gc->clip_mask)->value.region);
10941250 }
10951251
10961252 if ((gc->fill_style == FillStippled
11411297 */
11421298
11431299 PatBlt(dcMem, 0, 0, size.cx, size.cy, BLACKNESS);
1144 MultiFontTextOut(dc, fontPtr, source, numBytes, x, y);
1145 BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem,
1300 MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
1301 BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem,
11461302 0, 0, 0xEA02E9);
11471303 PatBlt(dcMem, 0, 0, size.cx, size.cy, WHITENESS);
1148 MultiFontTextOut(dc, fontPtr, source, numBytes, x, y);
1149 BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem,
1304 MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
1305 BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem,
11501306 0, 0, 0x8A0E06);
11511307
11521308 /*
11621318 SetTextAlign(dc, TA_LEFT | TA_BASELINE);
11631319 SetTextColor(dc, gc->foreground);
11641320 SetBkMode(dc, TRANSPARENT);
1165 MultiFontTextOut(dc, fontPtr, source, numBytes, x, y);
1321 MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
11661322 } else {
11671323 HBITMAP oldBitmap, bitmap;
11681324 HDC dcMem;
11861342 bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
11871343 oldBitmap = SelectObject(dcMem, bitmap);
11881344
1189 MultiFontTextOut(dcMem, fontPtr, source, numBytes, 0, tm.tmAscent);
1190 BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem,
1345 MultiFontTextOut(dcMem, fontPtr, source, numBytes, 0, tm.tmAscent,
1346 angle);
1347 BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem,
11911348 0, 0, (DWORD) tkpWinBltModes[gc->function]);
11921349
11931350 /*
12411398 * drawing. */
12421399 {
12431400 (void) numBytes; /*unused*/
1244 Tk_DrawChars(display, drawable, gc, tkfont,
1245 source + rangeStart, rangeLength, x, y);
1401 Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
1402 rangeLength, x, y);
12461403 }
12471404
12481405 /*
12721429 * following string. */
12731430 const char *source, /* Potentially multilingual UTF-8 string. */
12741431 int numBytes, /* Length of string in bytes. */
1275 int x, int y) /* Coordinates at which to place origin of
1432 int x, int y, /* Coordinates at which to place origin of
12761433 * string when drawing. */
1434 double angle)
12771435 {
12781436 Tcl_UniChar ch;
12791437 SIZE size;
12851443 TEXTMETRIC tm;
12861444
12871445 lastSubFontPtr = &fontPtr->subFontArray[0];
1288 oldFont = SelectObject(hdc, lastSubFontPtr->hFont);
1446 oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
12891447 GetTextMetrics(hdc, &tm);
12901448
12911449 end = source + numBytes;
12971455 familyPtr = lastSubFontPtr->familyPtr;
12981456 Tcl_UtfToExternalDString(familyPtr->encoding, source,
12991457 (int) (p - source), &runString);
1300 (*familyPtr->textOutProc)(hdc, x-(tm.tmOverhang/2), y,
1458 familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
13011459 Tcl_DStringValue(&runString),
13021460 Tcl_DStringLength(&runString)>>familyPtr->isWideFont);
1303 (*familyPtr->getTextExtentPoint32Proc)(hdc,
1461 familyPtr->getTextExtentPoint32Proc(hdc,
13041462 Tcl_DStringValue(&runString),
13051463 Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
13061464 &size);
13091467 }
13101468 lastSubFontPtr = thisSubFontPtr;
13111469 source = p;
1312 SelectObject(hdc, lastSubFontPtr->hFont);
1470 SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
13131471 GetTextMetrics(hdc, &tm);
13141472 }
13151473 p = next;
13181476 familyPtr = lastSubFontPtr->familyPtr;
13191477 Tcl_UtfToExternalDString(familyPtr->encoding, source,
13201478 (int) (p - source), &runString);
1321 (*familyPtr->textOutProc)(hdc, x-(tm.tmOverhang/2), y,
1479 familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
13221480 Tcl_DStringValue(&runString),
13231481 Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
13241482 Tcl_DStringFree(&runString);
13251483 }
13261484 SelectObject(hdc, oldFont);
1485 }
1486
1487 static inline HFONT
1488 SelectFont(
1489 HDC hdc,
1490 WinFont *fontPtr,
1491 SubFont *subFontPtr,
1492 double angle)
1493 {
1494 if (angle == 0.0) {
1495 return SelectObject(hdc, subFontPtr->hFont0);
1496 } else if (angle == subFontPtr->angle) {
1497 return SelectObject(hdc, subFontPtr->hFontAngled);
1498 } else {
1499 if (subFontPtr->hFontAngled) {
1500 DeleteObject(subFontPtr->hFontAngled);
1501 }
1502 subFontPtr->hFontAngled = GetScreenFont(&fontPtr->font.fa,
1503 subFontPtr->familyPtr->faceName, fontPtr->pixelSize, angle);
1504 if (subFontPtr->hFontAngled == NULL) {
1505 return SelectObject(hdc, subFontPtr->hFont0);
1506 }
1507 subFontPtr->angle = angle;
1508 return SelectObject(hdc, subFontPtr->hFontAngled);
1509 }
13271510 }
13281511
13291512 /*
14021585
14031586 fontPtr->font.fid = (Font) fontPtr;
14041587 fontPtr->hwnd = hwnd;
1405 fontPtr->pixelSize = tm.tmHeight - tm.tmInternalLeading;
1588 fontPtr->pixelSize = tm.tmHeight;
1589
1590 /*
1591 * The font pixelSize should be the tmHeight - tmInternalLeading
1592 * but this causes fonts to appear too small on for instance
1593 * Russian systems where there is internal leading in use.
1594 * This hack appears to sort things out.
1595 * NB: the logic on this flag is reversed - this means if the
1596 * font is not fixed then subtract the leading value.
1597 */
1598
1599 if (tm.tmPitchAndFamily & TMPF_FIXED_PITCH) {
1600 fontPtr->pixelSize -= tm.tmInternalLeading;
1601 }
14061602
14071603 faPtr = &fontPtr->font.fa;
14081604 faPtr->family = Tk_GetUid(Tcl_DStringValue(&faceString));
14091605
14101606 faPtr->size =
1411 TkFontGetPoints(tkwin, -(fontPtr->pixelSize));
1607 TkFontGetPoints(tkwin, -(fontPtr->pixelSize));
14121608 faPtr->weight =
14131609 (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
14141610 faPtr->slant = (tm.tmItalic != 0) ? TK_FS_ITALIC : TK_FS_ROMAN;
14861682 *-------------------------------------------------------------------------
14871683 */
14881684
1489 static void
1685 static inline void
14901686 InitSubFont(
14911687 HDC hdc, /* HDC in which font can be selected. */
14921688 HFONT hFont, /* The screen font. */
14951691 SubFont *subFontPtr) /* Filled with SubFont constructed from above
14961692 * attributes. */
14971693 {
1498 subFontPtr->hFont = hFont;
1694 subFontPtr->hFont0 = hFont;
14991695 subFontPtr->familyPtr = AllocFontFamily(hdc, hFont, base);
15001696 subFontPtr->fontMap = subFontPtr->familyPtr->fontMap;
1697 subFontPtr->hFontAngled = NULL;
1698 subFontPtr->angle = 0.0;
15011699 }
15021700
15031701 /*
15171715 *---------------------------------------------------------------------------
15181716 */
15191717
1520 static void
1718 static inline void
15211719 ReleaseSubFont(
15221720 SubFont *subFontPtr) /* The SubFont to delete. */
15231721 {
1524 DeleteObject(subFontPtr->hFont);
1722 DeleteObject(subFontPtr->hFont0);
1723 if (subFontPtr->hFontAngled) {
1724 DeleteObject(subFontPtr->hFontAngled);
1725 }
15251726 FreeFontFamily(subFontPtr->familyPtr);
15261727 }
15271728
15651766 Tcl_DString faceString;
15661767 Tcl_Encoding encoding;
15671768 char buf[LF_FACESIZE * sizeof(WCHAR)];
1568 ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
1769 ThreadSpecificData *tsdPtr =
15691770 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
15701771
15711772 hFont = SelectObject(hdc, hFont);
16731874 {
16741875 int i;
16751876 FontFamily **familyPtrPtr;
1676 ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
1877 ThreadSpecificData *tsdPtr =
16771878 Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
16781879
16791880 if (familyPtr == NULL) {
17441945 HDC hdc;
17451946 int i, j, k;
17461947 CanUse canUse;
1747 char **aliases, **anyFallbacks;
1748 char ***fontFallbacks;
1749 char *fallbackName;
1948 const char *const *aliases;
1949 const char *const *anyFallbacks;
1950 const char *const *const *fontFallbacks;
1951 const char *fallbackName;
17501952 SubFont *subFontPtr;
17511953 Tcl_DString ds;
17521954
20312233 if (endCount[j] >= i) {
20322234 if (startCount[j] <= i) {
20332235 bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
2034 subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
2236 subFontPtr->fontMap[row][bitOffset >> 3] |=
2237 1 << (bitOffset & 7);
20352238 }
20362239 break;
20372240 }
20892292 HDC hdc, /* HDC in which font can be selected. */
20902293 WinFont *fontPtr, /* The font object that will own the new
20912294 * screen font. */
2092 char *faceName, /* Desired face name for new screen font. */
2295 const char *faceName, /* Desired face name for new screen font. */
20932296 int ch, /* The Unicode character that the new screen
20942297 * font must be able to display. */
20952298 Tcl_DString *nameTriedPtr, /* Records face names that have already been
21002303 * array of subfonts. */
21012304 {
21022305 int i;
2103 char **aliases;
2306 const char *const *aliases;
21042307 SubFont *subFontPtr;
21052308
21062309 if (SeenName(faceName, nameTriedPtr) == 0) {
21922395 HDC hdc, /* HDC in which font can be selected. */
21932396 WinFont *fontPtr, /* The font object that will own the new
21942397 * screen font. */
2195 char *faceName, /* Desired face name for new screen font. */
2398 const char *faceName, /* Desired face name for new screen font. */
21962399 int ch, /* The Unicode character that the new screen
21972400 * font must be able to display. */
21982401 SubFont **subFontPtrPtr) /* Variable to fix-up if we realloc the array
22202423 * Load this font and see if it has the desired character.
22212424 */
22222425
2223 hFont = GetScreenFont(&fontPtr->font.fa, faceName, fontPtr->pixelSize);
2426 hFont = GetScreenFont(&fontPtr->font.fa, faceName, fontPtr->pixelSize,
2427 0.0);
22242428 InitSubFont(hdc, hFont, 0, &subFont);
22252429 if (((ch < 256) && (subFont.familyPtr->isSymbolFont))
22262430 || (FontMapLookup(&subFont, ch) == 0)) {
22362440 if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
22372441 SubFont *newPtr;
22382442
2239 newPtr = (SubFont *) ckalloc(sizeof(SubFont)
2240 * (fontPtr->numSubFonts + 1));
2241 memcpy((char *) newPtr, fontPtr->subFontArray,
2443 newPtr = (SubFont *)
2444 ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
2445 memcpy(newPtr, fontPtr->subFontArray,
22422446 fontPtr->numSubFonts * sizeof(SubFont));
22432447 if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
22442448 ckfree((char *) fontPtr->subFontArray);
22802484 /* Desired font attributes for new HFONT. */
22812485 const char *faceName, /* Overrides font family specified in font
22822486 * attributes. */
2283 int pixelSize) /* Overrides size specified in font
2487 int pixelSize, /* Overrides size specified in font
22842488 * attributes. */
2489 double angle) /* What is the desired orientation of the
2490 * font. */
22852491 {
22862492 Tcl_DString ds;
22872493 HFONT hFont;
22902496 memset(&lf, 0, sizeof(lf));
22912497 lf.lfHeight = -pixelSize;
22922498 lf.lfWidth = 0;
2293 lf.lfEscapement = 0;
2294 lf.lfOrientation = 0;
2499 lf.lfEscapement = (int) floor(angle * 10 + 0.5);
2500 lf.lfOrientation = (int) floor(angle * 10 + 0.5);
22952501 lf.lfWeight = (faPtr->weight == TK_FW_NORMAL) ? FW_NORMAL : FW_BOLD;
22962502 lf.lfItalic = faPtr->slant;
22972503 lf.lfUnderline = faPtr->underline;
23992605 return (result == 0);
24002606 }
24012607
2402 static char *
2608 static const char *
24032609 FamilyOrAliasExists(
24042610 HDC hdc,
24052611 const char *faceName)
24062612 {
2407 char **aliases;
2613 const char *const *aliases;
24082614 int i;
24092615
24102616 if (FamilyExists(hdc, faceName) != 0) {
27092915 *-------------------------------------------------------------------------
27102916 */
27112917
2712 static void
2918 static inline void
27132919 SwapShort(
27142920 PUSHORT p)
27152921 {
27162922 *p = (SHORT)(HIBYTE(*p) + (LOBYTE(*p) << 8));
27172923 }
27182924
2719 static void
2925 static inline void
27202926 SwapLong(
27212927 PULONG p)
27222928 {
77 * See the file "license.terms" for information on usage and redistribution
88 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
99 *
10 * RCS: @(#) $Id: tkWinImage.c,v 1.11 2007/01/12 10:41:23 dkf Exp $
10 * RCS: @(#) $Id: tkWinImage.c,v 1.12 2008/10/17 23:18:38 nijtmans Exp $
1111 */
1212
1313 #include "tkWinInt.h"
640640 imagePtr = XGetImageZPixmap(display, d, x, y,
641641 width, height, plane_mask, format);
642642 } else {
643 char *errMsg = NULL;
643 const char *errMsg = NULL;
644644 char infoBuf[sizeof(BITMAPINFO) + sizeof(RGBQUAD)];
645645 BITMAPINFO *infoPtr = (BITMAPINFO*)infoBuf;
646646
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkWinInt.h,v 1.31 2007/12/14 15:56:09 patthoyts Exp $
12 * RCS: @(#) $Id: tkWinInt.h,v 1.32 2008/12/10 05:02:52 das Exp $
1313 */
1414
1515 #ifndef _TKWININT
210210 BOOL (WINAPI *insertMenu)(HMENU hMenu, UINT uPosition, UINT uFlags,
211211 UINT uIDNewItem, LPCTSTR lpNewItem);
212212 int (WINAPI *getWindowText)(HWND hWnd, LPCTSTR lpString, int nMaxCount);
213 HWND (WINAPI *findWindow)(LPCTSTR lpClassName, LPCTSTR lpWindowName);
214 int (WINAPI *getClassName)(HWND hwnd, LPTSTR lpClassName, int nMaxCount);
213215 } TkWinProcs;
214216
215217 EXTERN TkWinProcs *tkWinProcs;
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkWinMenu.c,v 1.59 2007/12/13 15:28:56 dgp Exp $
12 * RCS: @(#) $Id: tkWinMenu.c,v 1.62 2008/12/09 21:22:56 dgp Exp $
1313 */
1414
1515 #define OEMRESOURCE
451451 strcpy(itemText, "( )");
452452 } else {
453453 int i;
454 char *label = (mePtr->labelPtr == NULL) ? ""
454 const char *label = (mePtr->labelPtr == NULL) ? ""
455455 : Tcl_GetString(mePtr->labelPtr);
456 char *accel = (mePtr->accelPtr == NULL) ? ""
456 const char *accel = (mePtr->accelPtr == NULL) ? ""
457457 : Tcl_GetString(mePtr->accelPtr);
458458 const char *p, *next;
459459 Tcl_DString itemString;
668668 }
669669 }
670670 if (!systemMenu) {
671 (*tkWinProcs->insertMenu)(winMenuHdl, 0xFFFFFFFF, flags,
671 tkWinProcs->insertMenu(winMenuHdl, 0xFFFFFFFF, flags,
672672 itemID, lpNewItem);
673673 }
674674 Tcl_DStringFree(&translatedText);
10311031 if ((code != TCL_OK) && (code != TCL_CONTINUE)
10321032 && (code != TCL_BREAK)) {
10331033 Tcl_AddErrorInfo(interp, "\n (menu preprocess)");
1034 Tcl_BackgroundError(interp);
1034 Tcl_BackgroundException(interp, code);
10351035 }
10361036 Tcl_Release((ClientData)interp);
10371037 }
10901090 code = TkInvokeMenu(interp, menuPtr, mePtr->index);
10911091 if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) {
10921092 Tcl_AddErrorInfo(interp, "\n (menu invoke)");
1093 Tcl_BackgroundError(interp);
1093 Tcl_BackgroundException(interp, code);
10941094 }
10951095 Tcl_Release((ClientData)interp);
10961096 *plResult = 0;
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkWinScrlbr.c,v 1.16 2008/10/03 13:13:31 dkf Exp $
11 * RCS: @(#) $Id: tkWinScrlbr.c,v 1.17 2008/12/09 21:22:56 dgp Exp $
1212 */
1313
1414 #include "tkWinInt.h"
571571 code = Tcl_GlobalEval(interp, cmdString.string);
572572 if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) {
573573 Tcl_AddErrorInfo(interp, "\n (scrollbar command)");
574 Tcl_BackgroundError(interp);
574 Tcl_BackgroundException(interp, code);
575575 }
576576 Tcl_DStringFree(&cmdString);
577577
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkWinSend.c,v 1.17 2008/10/05 18:22:22 dkf Exp $
12 * RCS: @(#) $Id: tkWinSend.c,v 1.18 2008/10/17 23:18:38 nijtmans Exp $
1313 */
1414
1515 #include "tkInt.h"
6767 static void InterpDeleteProc(ClientData clientData,
6868 Tcl_Interp *interp);
6969 #endif
70 #ifdef TK_SEND_ENABLED_ON_WINDOWS
7071 static void RevokeObjectRegistration(RegisteredInterp *riPtr);
72 #endif
7173 static HRESULT BuildMoniker(const char *name, LPMONIKER *pmk);
7274 #ifdef TK_SEND_ENABLED_ON_WINDOWS
7375 static HRESULT RegisterInterp(const char *name,
8789 #else
8890 #define TRACE 1 ? ((void)0) : SendTrace
8991 #endif
90
92
9193 /*
9294 *--------------------------------------------------------------
9395 *
188190 return (const char *) riPtr->name;
189191 #endif /* TK_SEND_ENABLED_ON_WINDOWS */
190192 }
191
193
192194 /*
193195 *----------------------------------------------------------------------
194196 *
294296 return result;
295297 #endif /* TK_SEND_ENABLED_ON_WINDOWS */
296298 }
297
299
298300 /*
299301 *--------------------------------------------------------------
300302 *
323325 enum {
324326 SEND_ASYNC, SEND_DISPLAYOF, SEND_LAST
325327 };
326 static const char *sendOptions[] = {
328 static const char *const sendOptions[] = {
327329 "-async", "-displayof", "--", NULL
328330 };
329331 int result = TCL_OK;
386388
387389 return result;
388390 }
389
391
390392 /*
391393 *--------------------------------------------------------------
392394 *
455457 }
456458 return result;
457459 }
458
460
459461 /*
460462 *--------------------------------------------------------------
461463 *
510512
511513 ckfree(clientData);
512514 }
513 #endif
514
515
515516 /*
516517 *--------------------------------------------------------------
517518 *
555556 riPtr->name = NULL;
556557 }
557558 }
558
559 #endif
560
559561 /*
560562 * ----------------------------------------------------------------------
561563 *
582584 CoUninitialize();
583585 }
584586 #endif
585
587
586588 /*
587589 * ----------------------------------------------------------------------
588590 *
625627 }
626628 return hr;
627629 }
628
630
629631 /*
630632 * ----------------------------------------------------------------------
631633 *
703705 return hr;
704706 }
705707 #endif
706
708
707709 /*
708710 * ----------------------------------------------------------------------
709711 *
811813
812814 return (SUCCEEDED(hr) ? TCL_OK : TCL_ERROR);
813815 }
814
816
815817 /*
816818 * ----------------------------------------------------------------------
817819 *
861863
862864 return errPtr;
863865 }
864
866
865867 /*
866868 * ----------------------------------------------------------------------
867869 *
925927 }
926928 }
927929 }
928
930
929931 /*
930932 * ----------------------------------------------------------------------
931933 *
969971
970972 return 0;
971973 }
972
974
973975 /*
974976 * ----------------------------------------------------------------------
975977 *
10061008
10071009 return 1; /* 1 to indicate the event has been handled */
10081010 }
1009
1011
10101012 /*
10111013 * ----------------------------------------------------------------------
10121014 *
10371039 OutputDebugString(buffer);
10381040 va_end(args);
10391041 }
1040
1042
10411043 /*
10421044 * Local Variables:
10431045 * mode: c
1010 * See the file "license.terms" for information on usage and redistribution of
1111 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1212 *
13 * RCS: @(#) $Id: tkWinTest.c,v 1.17 2008/04/27 22:39:17 dkf Exp $
13 * RCS: @(#) $Id: tkWinTest.c,v 1.24 2008/12/10 05:02:52 das Exp $
1414 */
1515
1616 #include "tkWinInt.h"
3232 static int TestgetwindowinfoObjCmd(ClientData clientData,
3333 Tcl_Interp *interp, int objc,
3434 Tcl_Obj *const objv[]);
35 static int TestwinlocaleObjCmd(ClientData clientData,
36 Tcl_Interp *interp, int objc,
37 Tcl_Obj *const objv[]);
3538 MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
36
37
39 static Tk_GetSelProc SetSelectionResult;
40
3841 /*
3942 *----------------------------------------------------------------------
4043 *
6871 (ClientData) Tk_MainWindow(interp), NULL);
6972 Tcl_CreateObjCommand(interp, "testgetwindowinfo", TestgetwindowinfoObjCmd,
7073 (ClientData) Tk_MainWindow(interp), NULL);
71
74 Tcl_CreateObjCommand(interp, "testwinlocale", TestwinlocaleObjCmd,
75 (ClientData) Tk_MainWindow(interp), NULL);
7276 return TCL_OK;
7377 }
7478
121125 }
122126 if (length == 0) {
123127 if (error == ERROR_CALL_NOT_IMPLEMENTED) {
124 msg = "function not supported under Win32s";
128 msg = (char *)"function not supported under Win32s";
125129 } else {
126130 sprintf(msgBuf, "unknown error: %ld", error);
127131 msg = msgBuf;
173177 *
174178 *----------------------------------------------------------------------
175179 */
180
181 static int
182 SetSelectionResult(
183 ClientData dummy,
184 Tcl_Interp *interp,
185 const char *selection)
186 {
187 Tcl_AppendResult(interp, selection, NULL);
188 return TCL_OK;
189 }
176190
177191 static int
178192 TestclipboardObjCmd(
181195 int objc, /* Number of arguments. */
182196 Tcl_Obj *const objv[]) /* Argument values. */
183197 {
184 HGLOBAL handle;
185 char *data;
186 int code = TCL_OK;
198 Tk_Window tkwin = (Tk_Window) clientData;
187199
188200 if (objc != 1) {
189201 Tcl_WrongNumArgs(interp, 1, objv, NULL);
190202 return TCL_ERROR;
191203 }
192 if (OpenClipboard(NULL)) {
193 /*
194 * We could consider using CF_UNICODETEXT on NT, but then we would
195 * have to convert it from External. Instead we'll just take this and
196 * do "bytestring" at the Tcl level for Unicode inclusive text
197 */
198
199 handle = GetClipboardData(CF_TEXT);
200 if (handle != NULL) {
201 data = GlobalLock(handle);
202 Tcl_AppendResult(interp, data, NULL);
203 GlobalUnlock(handle);
204 } else {
205 Tcl_AppendResult(interp, "null clipboard handle", NULL);
206 code = TCL_ERROR;
207 }
208 CloseClipboard();
209 return code;
210 } else {
211 Tcl_AppendResult(interp, "couldn't open clipboard: ", NULL);
212 AppendSystemError(interp, GetLastError());
213 return TCL_ERROR;
214 }
215 return TCL_OK;
204 return TkSelGetSelection(interp, tkwin, Tk_InternAtom(tkwin, "CLIPBOARD"),
205 XA_STRING, SetSelectionResult, NULL);
216206 }
217207
218208 /*
304294 child = GetWindow(child, GW_HWNDNEXT);
305295 }
306296 if (child == NULL) {
297 Tcl_AppendResult(interp, "could not find a control matching \"",
298 argv[2], "\"", NULL);
307299 return TCL_ERROR;
308300 }
309301 }
365357 /*
366358 * testfindwindow title ?class?
367359 * Find a Windows window using the FindWindow API call. This takes the window
368 * title and optionally the window class and if found returns the HWND and
360 * title and optionally the window class and if found returns the HWND and
369361 * raises an error if the window is not found.
370362 * eg: testfindwindow Console TkTopLevel
371363 * Can find the console window if it is visible.
380372 int objc, /* Number of arguments. */
381373 Tcl_Obj *const objv[]) /* Argument values. */
382374 {
383 const char *title = NULL, *class = NULL;
375 const TCHAR *title = NULL, *class = NULL;
376 Tcl_DString titleString, classString;
384377 HWND hwnd = NULL;
385378 int r = TCL_OK;
379
380 Tcl_DStringInit(&classString);
381 Tcl_DStringInit(&titleString);
386382
387383 if (objc < 2 || objc > 3) {
388384 Tcl_WrongNumArgs(interp, 1, objv, "title ?class?");
389385 return TCL_ERROR;
390386 }
391 title = Tcl_GetString(objv[1]);
392 if (objc == 3)
393 class = Tcl_GetString(objv[2]);
394 hwnd = FindWindowA(class, title);
387
388 title = Tcl_WinUtfToTChar(Tcl_GetString(objv[1]), -1, &titleString);
389 if (objc == 3) {
390 class = Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
391 }
392
393 hwnd = tkWinProcs->findWindow(class, title);
395394
396395 if (hwnd == NULL) {
397396 Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1));
400399 } else {
401400 Tcl_SetObjResult(interp, Tcl_NewLongObj((long)hwnd));
402401 }
402
403 Tcl_DStringFree(&titleString);
404 Tcl_DStringFree(&classString);
403405 return r;
404
406
405407 }
406408
407409 static BOOL CALLBACK
408 EnumChildrenProc(HWND hwnd, LPARAM lParam)
409 {
410 Tcl_Obj *listObj = (Tcl_Obj *)lParam;
411 Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj((long)hwnd));
410 EnumChildrenProc(
411 HWND hwnd,
412 LPARAM lParam)
413 {
414 Tcl_Obj *listObj = (Tcl_Obj *) lParam;
415
416 Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj((long) hwnd));
412417 return TRUE;
413418 }
414419
420425 Tcl_Obj *const objv[])
421426 {
422427 HWND hwnd = NULL;
423 Tcl_Obj *resObj = NULL, *classObj = NULL, *textObj = NULL;
428 Tcl_Obj *dictObj = NULL, *classObj = NULL, *textObj = NULL;
424429 Tcl_Obj *childrenObj = NULL;
425430 char buf[512];
426431 int cch, cchBuf = tkWinProcs->useWide ? 256 : 512;
432437
433438 if (Tcl_GetLongFromObj(interp, objv[1], (long *)&hwnd) != TCL_OK)
434439 return TCL_ERROR;
435
436 if (tkWinProcs->useWide) {
437 cch = GetClassNameW(hwnd, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR));
438 classObj = Tcl_NewUnicodeObj((LPWSTR)buf, cch);
439 } else {
440 cch = GetClassNameA(hwnd, (LPSTR)buf, sizeof(buf));
441 classObj = Tcl_NewStringObj((LPSTR)buf, cch);
442 }
440
441 cch = tkWinProcs->getClassName(hwnd, buf, cchBuf);
443442 if (cch == 0) {
444443 Tcl_SetResult(interp, "failed to get class name: ", TCL_STATIC);
445444 AppendSystemError(interp, GetLastError());
446445 return TCL_ERROR;
447 }
448
449 resObj = Tcl_NewListObj(0, NULL);
450 Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("class", -1));
451 Tcl_ListObjAppendElement(interp, resObj, classObj);
452
453 Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("id", -1));
454 Tcl_ListObjAppendElement(interp, resObj,
446 } else {
447 Tcl_DString ds;
448 Tcl_WinTCharToUtf(buf, -1, &ds);
449 classObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
450 Tcl_DStringFree(&ds);
451 }
452
453 dictObj = Tcl_NewDictObj();
454 Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
455 Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
455456 Tcl_NewLongObj(GetWindowLong(hwnd, GWL_ID)));
456457
457458 cch = tkWinProcs->getWindowText(hwnd, (LPTSTR)buf, cchBuf);
461462 textObj = Tcl_NewStringObj((LPCSTR)buf, cch);
462463 }
463464
464 Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("text", -1));
465 Tcl_ListObjAppendElement(interp, resObj, textObj);
466 Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("parent", -1));
467 Tcl_ListObjAppendElement(interp, resObj,
465 Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
466 Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
468467 Tcl_NewLongObj((long)GetParent(hwnd)));
469468
470469 childrenObj = Tcl_NewListObj(0, NULL);
471470 EnumChildWindows(hwnd, EnumChildrenProc, (LPARAM)childrenObj);
472 Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("children", -1));
473 Tcl_ListObjAppendElement(interp, resObj, childrenObj);
474
475 Tcl_SetObjResult(interp, resObj);
471 Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("children", -1), childrenObj);
472
473 Tcl_SetObjResult(interp, dictObj);
476474 return TCL_OK;
477 }
475 }
476
477 static int
478 TestwinlocaleObjCmd(
479 ClientData clientData, /* Main window for application. */
480 Tcl_Interp *interp, /* Current interpreter. */
481 int objc, /* Number of arguments. */
482 Tcl_Obj *const objv[]) /* Argument values. */
483 {
484 if (objc != 1) {
485 Tcl_WrongNumArgs(interp, 1, objv, NULL);
486 return TCL_ERROR;
487 }
488 Tcl_SetObjResult(interp, Tcl_NewIntObj((int)GetThreadLocale()));
489 return TCL_OK;
490 }
478491
479492 /*
480493 * Local Variables:
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: tkWinWindow.c,v 1.18 2008/08/19 15:52:14 georgeps Exp $
11 * RCS: @(#) $Id: tkWinWindow.c,v 1.19 2008/10/20 10:50:20 dkf Exp $
1212 */
1313
1414 #include "tkWinInt.h"
15 #include "tkBusy.h"
1516
1617 typedef struct ThreadSpecificData {
1718 int initialized; /* 0 means table below needs initializing. */
173174 /*
174175 * Use pointer representation, because Win64 is P64 (*not* LP64). Windows
175176 * doesn't print the 0x for %p, so we do it.
176 * bug #2026405: cygwin does output 0x for %p so test and recover.
177 * Bug 2026405: cygwin does output 0x for %p so test and recover.
177178 */
178179
179180 sprintf(buf, "0x%p", hwnd);
180 if (buf[2] == '0' && buf[3] == 'x')
181 if (buf[2] == '0' && buf[3] == 'x') {
181182 sprintf(buf, "%p", hwnd);
183 }
182184 }
183185
184186 /*
783785 }
784786
785787 /*
788 *----------------------------------------------------------------------
789 *
790 * TkpShowBusyWindow --
791 *
792 * Makes a busy window "appear".
793 *
794 * Results:
795 * None.
796 *
797 * Side effects:
798 * Arranges for the busy window to start intercepting events and the
799 * cursor to change to the configured "hey, I'm busy!" setting.
800 *
801 *----------------------------------------------------------------------
802 */
803
804 void
805 TkpShowBusyWindow(
806 TkBusy busy)
807 {
808 Busy *busyPtr = (Busy *) busy;
809 HWND hWnd;
810 POINT point;
811 Display *display;
812 Window window;
813
814 if (busyPtr->tkBusy != NULL) {
815 Tk_MapWindow(busyPtr->tkBusy);
816 window = Tk_WindowId(busyPtr->tkBusy);
817 display = Tk_Display(busyPtr->tkBusy);
818 hWnd = Tk_GetHWND(window);
819 display->request++;
820 SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
821 }
822
823 /*
824 * Under Win32, cursors aren't associated with windows. Tk fakes this by
825 * watching Motion events on its windows. So Tk will automatically change
826 * the cursor when the pointer enters the Busy window. But Windows does
827 * not immediately change the cursor; it waits for the cursor position to
828 * change or a system call. We need to change the cursor before the
829 * application starts processing, so set the cursor position redundantly
830 * back to the current position.
831 */
832
833 GetCursorPos(&point);
834 SetCursorPos(point.x, point.y);
835 }
836
837 /*
838 *----------------------------------------------------------------------
839 *
840 * TkpHideBusyWindow --
841 *
842 * Makes a busy window "disappear".
843 *
844 * Results:
845 * None.
846 *
847 * Side effects:
848 * Arranges for the busy window to stop intercepting events, and the
849 * cursor to change back to its normal setting.
850 *
851 *----------------------------------------------------------------------
852 */
853
854 void
855 TkpHideBusyWindow(
856 TkBusy busy)
857 {
858 Busy *busyPtr = (Busy *) busy;
859 POINT point;
860
861 if (busyPtr->tkBusy != NULL) {
862 Tk_UnmapWindow(busyPtr->tkBusy);
863 }
864
865 /*
866 * Under Win32, cursors aren't associated with windows. Tk fakes this by
867 * watching Motion events on its windows. So Tk will automatically change
868 * the cursor when the pointer enters the Busy window. But Windows does
869 * not immediately change the cursor: it waits for the cursor position to
870 * change or a system call. We need to change the cursor before the
871 * application starts processing, so set the cursor position redundantly
872 * back to the current position.
873 */
874
875 GetCursorPos(&point);
876 SetCursorPos(point.x, point.y);
877 }
878
879 /*
880 *----------------------------------------------------------------------
881 *
882 * TkpMakeTransparentWindowExist --
883 *
884 * Construct the platform-specific resources for a transparent window.
885 *
886 * Results:
887 * None.
888 *
889 * Side effects:
890 * Moves the specified window in the stacking order.
891 *
892 *----------------------------------------------------------------------
893 */
894
895 void
896 TkpMakeTransparentWindowExist(
897 Tk_Window tkwin, /* Token for window. */
898 Window parent) /* Parent window. */
899 {
900 TkWindow *winPtr = (TkWindow *) tkwin;
901 HWND hParent = (HWND) parent, hWnd;
902 int style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
903 DWORD exStyle = WS_EX_TRANSPARENT | WS_EX_TOPMOST;
904
905 #define TK_WIN_CHILD_CLASS_NAME "TkChild"
906 hWnd = CreateWindowEx(exStyle, TK_WIN_CHILD_CLASS_NAME, NULL, style,
907 Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin),
908 hParent, NULL, Tk_GetHINSTANCE(), NULL);
909 winPtr->window = Tk_AttachHWND(tkwin, hWnd);
910 }
911
912 /*
913 *----------------------------------------------------------------------
914 *
915 * TkpCreateBusy --
916 *
917 * Construct the platform-specific parts of a busy window. Note that this
918 * postpones the actual creation of the window resource until later.
919 *
920 * Results:
921 * None.
922 *
923 * Side effects:
924 * Sets up part of the busy window structure.
925 *
926 *----------------------------------------------------------------------
927 */
928
929 void
930 TkpCreateBusy(
931 Tk_FakeWin *winPtr,
932 Tk_Window tkRef,
933 Window *parentPtr,
934 Tk_Window tkParent,
935 TkBusy busy)
936 {
937 Busy *busyPtr = (Busy *) busy;
938
939 if (winPtr->flags & TK_REPARENTED) {
940 /*
941 * This works around a bug in the implementation of menubars for
942 * non-Macintosh window systems (Win32 and X11). Tk doesn't reset the
943 * pointers to the parent window when the menu is reparented
944 * (winPtr->parentPtr points to the wrong window). We get around this
945 * by determining the parent via the native API calls.
946 */
947
948 HWND hWnd = GetParent(Tk_GetHWND(Tk_WindowId(tkRef)));
949 RECT rect;
950
951 if (GetWindowRect(hWnd, &rect)) {
952 busyPtr->width = rect.right - rect.left;
953 busyPtr->height = rect.bottom - rect.top;
954 }
955 } else {
956 *parentPtr = Tk_WindowId(tkParent);
957 *parentPtr = (Window) Tk_GetHWND(*parentPtr);
958 }
959 }
960
961 /*
786962 * Local Variables:
787963 * mode: c
788964 * c-basic-offset: 4
1111 * See the file "license.terms" for information on usage and redistribution of
1212 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1313 *
14 * RCS: @(#) $Id: tkWinWm.c,v 1.130 2008/10/06 21:57:21 patthoyts Exp $
14 * RCS: @(#) $Id: tkWinWm.c,v 1.134 2008/12/09 21:22:56 dgp Exp $
1515 */
1616
1717 #include "tkWinInt.h"
28292829 Tcl_Obj *const objv[]) /* Argument objects. */
28302830 {
28312831 Tk_Window tkwin = clientData;
2832 static const char *optionStrings[] = {
2832 static const char *const optionStrings[] = {
28332833 "aspect", "attributes", "client", "colormapwindows",
28342834 "command", "deiconify", "focusmodel", "forget", "frame",
28352835 "geometry", "grid", "group", "iconbitmap",
35363536 }
35373537 if (objc == 3) {
35383538 if (wmPtr->cmdArgv != NULL) {
3539 Tcl_SetResult(interp,
3540 Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv), TCL_DYNAMIC);
3539 argv3 = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
3540 Tcl_SetResult(interp, argv3, TCL_VOLATILE);
3541 ckfree(argv3);
35413542 }
35423543 return TCL_OK;
35433544 }
36413642 Tcl_Obj *const objv[]) /* Argument objects. */
36423643 {
36433644 register WmInfo *wmPtr = winPtr->wmInfoPtr;
3644 static const char *optionStrings[] = {
3645 static const char *const optionStrings[] = {
36453646 "active", "passive", NULL
36463647 };
36473648 enum options {
37123713 /* Already not managed by wm - ignore it */
37133714 }
37143715 return TCL_OK;
3715 }
3716 }
3717
37163718 /*
37173719 *----------------------------------------------------------------------
37183720 *
45864588 register WmInfo *wmPtr = winPtr->wmInfoPtr;
45874589
45884590 if (!Tk_IsTopLevel(frameWin)) {
4591 if (!Tk_IsManageable(frameWin)) {
4592 Tcl_AppendResult(interp, "window \"",
4593 Tk_PathName(frameWin), "\" is not manageable: must be "
4594 "a frame, labelframe or toplevel", NULL);
4595 return TCL_ERROR;
4596 }
45894597 TkFocusSplit(winPtr);
45904598 Tk_UnmapWindow(frameWin);
45914599 winPtr->flags |= TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED;
47954803 Tcl_Obj *const objv[]) /* Argument objects. */
47964804 {
47974805 register WmInfo *wmPtr = winPtr->wmInfoPtr;
4798 static const char *optionStrings[] = {
4806 static const char *const optionStrings[] = {
47994807 "program", "user", NULL
48004808 };
48014809 enum options {
50125020 Tcl_Obj *const objv[]) /* Argument objects. */
50135021 {
50145022 register WmInfo *wmPtr = winPtr->wmInfoPtr;
5015 static const char *optionStrings[] = {
5023 static const char *const optionStrings[] = {
50165024 "program", "user", NULL
50175025 };
50185026 enum options {
50785086 Tcl_Obj *const objv[]) /* Argument objects. */
50795087 {
50805088 TkWindow **windows, **window_ptr;
5081 static const char *optionStrings[] = {
5089 static const char *const optionStrings[] = {
50825090 "isabove", "isbelow", NULL
50835091 };
50845092 enum options {
51965204 Tcl_Obj *const objv[]) /* Argument objects. */
51975205 {
51985206 register WmInfo *wmPtr = winPtr->wmInfoPtr;
5199 static const char *optionStrings[] = {
5207 static const char *const optionStrings[] = {
52005208 "normal", "iconic", "withdrawn", "zoomed", NULL
52015209 };
52025210 enum options {
65146522 Tcl_Preserve(interp);
65156523 result = Tcl_GlobalEval(interp, protPtr->command);
65166524 if (result != TCL_OK) {
6517 Tcl_AddErrorInfo(interp, "\n (command for \"");
6518 Tcl_AddErrorInfo(interp, name);
6519 Tcl_AddErrorInfo(interp, "\" window manager protocol)");
6520 Tcl_BackgroundError(interp);
6525 Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
6526 "\n (command for \"%s\" window manager protocol)",
6527 name));
6528 Tcl_BackgroundException(interp, result);
65216529 }
65226530 Tcl_Release(interp);
65236531 Tcl_Release(protPtr);
84568464 *----------------------------------------------------------------------
84578465 */
84588466
8459 static void
8467 static void
84608468 RemapWindows(
84618469 TkWindow *winPtr,
84628470 HWND parentHWND)
99 * See the file "license.terms" for information on usage and redistribution of
1010 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1111 *
12 * RCS: @(#) $Id: tkWinX.c,v 1.58 2008/04/27 22:39:17 dkf Exp $
12 * RCS: @(#) $Id: tkWinX.c,v 1.59 2008/12/10 05:02:52 das Exp $
1313 */
1414
1515 /*
7878 (BOOL (WINAPI *)(HMENU hMenu, UINT uPosition, UINT uFlags,
7979 UINT uIDNewItem, LPCTSTR lpNewItem)) InsertMenuA,
8080 (int (WINAPI *)(HWND hWnd, LPCTSTR lpString, int nMaxCount)) GetWindowTextA,
81 (HWND (WINAPI *)(LPCTSTR lpClassName, LPCTSTR lpWindowName)) FindWindowA,
82 (int (WINAPI *)(HWND hwnd, LPTSTR lpClassName, int nMaxCount)) GetClassNameA,
8183 };
8284
8385 static TkWinProcs unicodeProcs = {
9698 (BOOL (WINAPI *)(HMENU hMenu, UINT uPosition, UINT uFlags,
9799 UINT uIDNewItem, LPCTSTR lpNewItem)) InsertMenuW,
98100 (int (WINAPI *)(HWND hWnd, LPCTSTR lpString, int nMaxCount)) GetWindowTextW,
101 (HWND (WINAPI *)(LPCTSTR lpClassName, LPCTSTR lpWindowName)) FindWindowW,
102 (int (WINAPI *)(HWND hwnd, LPTSTR lpClassName, int nMaxCount)) GetClassNameW,
99103 };
100104
101105 TkWinProcs *tkWinProcs;
00 /* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
11 *
2 * $Id: ttkWinTheme.c,v 1.13 2008/01/08 17:01:00 jenglish Exp $
2 * $Id: ttkWinTheme.c,v 1.14 2008/11/01 15:34:24 patthoyts Exp $
33 */
44
55 #ifdef _MSC_VER
103103 Ttk_Padding margins; /* additional placement padding */
104104 } FrameControlElementData;
105105
106 #define _FIXEDSIZE 0x8000
106 #define _FIXEDSIZE 0x80000000L
107 #define _HALFMETRIC 0x40000000L
107108 #define FIXEDSIZE(id) (id|_FIXEDSIZE)
109 #define HALFMETRIC(id) (id|_HALFMETRIC)
108110 #define GETMETRIC(m) \
109 ((m) & _FIXEDSIZE ? (m) & ~_FIXEDSIZE : GetSystemMetrics(m))
111 ((m) & _FIXEDSIZE ? (m) & ~_FIXEDSIZE : GetSystemMetrics((m)&0x0fffffff))
110112
111113 static FrameControlElementData FrameControlElements[] = {
112114 { "Checkbutton.indicator",
130132 { "sizegrip",
131133 DFC_SCROLL, DFCS_SCROLLSIZEGRIP, SM_CXVSCROLL, SM_CYHSCROLL,
132134 arrow_statemap, {0,0,0,0} },
135 { "Spinbox.uparrow",
136 DFC_SCROLL, DFCS_SCROLLUP, SM_CXVSCROLL, HALFMETRIC(SM_CYVSCROLL),
137 arrow_statemap, {0,0,0,0} },
138 { "Spinbox.downarrow",
139 DFC_SCROLL, DFCS_SCROLLDOWN, SM_CXVSCROLL, HALFMETRIC(SM_CYVSCROLL),
140 arrow_statemap, {0,0,0,0} },
133141
134142 { 0,0,0,0,0,0, {0,0,0,0} }
135143 };
141149 int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
142150 {
143151 FrameControlElementData *p = clientData;
144 *widthPtr = GETMETRIC(p->cxId) + Ttk_PaddingWidth(p->margins);
145 *heightPtr = GETMETRIC(p->cyId) + Ttk_PaddingHeight(p->margins);
152 int cx = GETMETRIC(p->cxId);
153 int cy = GETMETRIC(p->cyId);
154 if (p->cxId & _HALFMETRIC) cx /= 2;
155 if (p->cyId & _HALFMETRIC) cy /= 2;
156 *widthPtr = cx + Ttk_PaddingWidth(p->margins);
157 *heightPtr = cy + Ttk_PaddingHeight(p->margins);
146158 }
147159
148160 static void FrameControlElementDraw(
00 /*
1 * $Id: ttkWinXPTheme.c,v 1.20 2008/04/27 22:39:17 dkf Exp $
1 * $Id: ttkWinXPTheme.c,v 1.22 2008/12/05 11:11:58 patthoyts Exp $
22 *
33 * Tk theme engine which uses the Windows XP "Visual Styles" API
44 * Adapted from Georgios Petasis' XP theme patch.
257257 { CBXS_DISABLED, TTK_STATE_DISABLED, 0 },
258258 { CBXS_PRESSED, TTK_STATE_PRESSED, 0 },
259259 { CBXS_HOT, TTK_STATE_ACTIVE, 0 },
260 { CBXS_HOT, TTK_STATE_HOVER, 0 },
260261 { CBXS_NORMAL, 0, 0 }
261262 };
262263
314315 { ABS_RIGHTHOT, TTK_STATE_ACTIVE, 0 },
315316 { ABS_RIGHTNORMAL, 0, 0 }
316317 };
318
319 static Ttk_StateTable spinbutton_statemap[] =
320 {
321 { DNS_DISABLED, TTK_STATE_DISABLED, 0 },
322 { DNS_PRESSED, TTK_STATE_PRESSED, 0 },
323 { DNS_HOT, TTK_STATE_ACTIVE, 0 },
324 { DNS_NORMAL, 0, 0 },
325 };
317326
318327 /*
319328 * Trackbar thumb: (Tk: "scale slider")
581590 sizeof(NullElement),
582591 TtkNullElementOptions,
583592 GenericSizedElementSize,
593 GenericElementDraw
594 };
595
596 /*----------------------------------------------------------------------
597 * +++ Spinbox arrow element.
598 * These are half-height scrollbar buttons.
599 */
600
601 static void
602 SpinboxArrowElementSize(
603 void *clientData, void *elementRecord, Tk_Window tkwin,
604 int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
605 {
606 ElementData *elementData = clientData;
607
608 if (!InitElementData(elementData, tkwin, 0))
609 return;
610
611 GenericSizedElementSize(clientData, elementRecord, tkwin,
612 widthPtr, heightPtr, paddingPtr);
613
614 /* force the arrow button height to half size */
615 *heightPtr /= 2;
616 }
617
618 static Ttk_ElementSpec SpinboxArrowElementSpec = {
619 TK_STYLE_VERSION_2,
620 sizeof(NullElement),
621 TtkNullElementOptions,
622 SpinboxArrowElementSize,
584623 GenericElementDraw
585624 };
586625
9631002 HP_HEADERITEM, header_statemap, PAD(4,0,4,0),0 },
9641003 { "sizegrip", &GenericElementSpec, L"STATUS",
9651004 SP_GRIPPER, null_statemap, NOPAD,0 },
1005 { "Spinbox.field", &GenericElementSpec, L"EDIT",
1006 EP_EDITTEXT, edittext_statemap, PAD(1, 1, 1, 1), 0 },
1007 { "Spinbox.uparrow", &SpinboxArrowElementSpec, L"SPIN",
1008 SPNP_UP, spinbutton_statemap, NOPAD,
1009 PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
1010 { "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN",
1011 SPNP_DOWN, spinbutton_statemap, NOPAD,
1012 PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
9661013
9671014 #if BROKEN_TEXT_ELEMENT
9681015 { "Labelframe.text", &TextElementSpec, L"BUTTON",
11281175 XPThemeData *themeData;
11291176 XPThemeProcs *procs;
11301177 HINSTANCE hlibrary;
1131 Ttk_Theme themePtr, parentPtr;
1178 Ttk_Theme themePtr, parentPtr, vistaPtr;
11321179 ElementInfo *infoPtr;
1180 OSVERSIONINFO os;
1181
1182 os.dwOSVersionInfoSize = sizeof(os);
1183 GetVersionEx(&os);
11331184
11341185 procs = LoadXPThemeProcs(&hlibrary);
11351186 if (!procs)
11561207 Ttk_SetThemeEnabledProc(themePtr, XPThemeEnabled, themeData);
11571208 Ttk_RegisterCleanup(interp, themeData, XPThemeDeleteProc);
11581209 Ttk_RegisterElementFactory(interp, "vsapi", Ttk_CreateVsapiElement, themeData);
1210
1211 /*
1212 * Create the vista theme on suitable platform versions and set the theme
1213 * enable function. The theme itself is defined in script.
1214 */
1215
1216 if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && os.dwMajorVersion > 5) {
1217 vistaPtr = Ttk_CreateTheme(interp, "vista", themePtr);
1218 if (vistaPtr) {
1219 Ttk_SetThemeEnabledProc(vistaPtr, XPThemeEnabled, themeData);
1220 }
1221 }
11591222
11601223 /*
11611224 * New elements:
88 * See the file "license.terms" for information on usage and redistribution of
99 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1010 *
11 * RCS: @(#) $Id: xcolors.c,v 1.7 2007/01/02 23:39:40 dkf Exp $
11 * RCS: @(#) $Id: xcolors.c,v 1.8 2008/10/17 23:18:38 nijtmans Exp $
1212 */
1313
1414 #include <tkInt.h>
3333 */
3434
3535 typedef struct {
36 char *name;
36 const char *name;
3737 unsigned char red, green, blue;
3838 } XColorEntry;
3939
40 static XColorEntry xColors[] = {
40 static const XColorEntry xColors[] = {
4141 { "alice blue", 240, 248, 255 },
4242 { "AliceBlue", 240, 248, 255 },
4343 { "antique white", 250, 235, 215 },
824824 */
825825
826826 if (numXColors == 0) {
827 XColorEntry *ePtr;
827 const XColorEntry *ePtr;
828828 for (ePtr = xColors; ePtr->name != NULL; ePtr++) {
829829 numXColors++;
830830 }